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)
This commit is contained in:
parent
81a7b12d7a
commit
8a557ca108
1 changed files with 4 additions and 3 deletions
|
@ -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");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue