From 8a557ca108e99898be2a3f05cac8cedbebe792de Mon Sep 17 00:00:00 2001 From: qorg11 Date: Thu, 27 Aug 2020 00:03:26 +0200 Subject: [PATCH] Modified the way lainsafe renames file Before this commit lainsafe would generate a random string which can create coallition between two files and shit would happen, after this commit, lainsafe generates its filenames by getting the UNIX time in miliseconds (like 4chan) --- http/upload.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/http/upload.cgi b/http/upload.cgi index bfb435f..45ac070 100755 --- a/http/upload.cgi +++ b/http/upload.cgi @@ -16,6 +16,7 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); +use Time::HiRes qw(gettimeofday); my $q = CGI->new; my $filename = $q->param('file'); @@ -46,10 +47,10 @@ if($size > $MAX_SIZE) my $extension = $filename; $extension =~ s/.*\.//; # tar.gz sucks with this -# Generate random string -my @chars = ("A".."Z", "a".."z"); +# Get unix time in miliseconds my $string; -$string .= $chars[rand @chars] for 1..8; +$string = gettimeofday; # perl, what? +$string =~ s/\.//g; my $upload_filehandle = $q->upload("file");