- if ($r->headers_in->{'content-length'} == 0) {
- $dbh->do('DELETE FROM fake_files WHERE expires_at <= now() OR (event=? AND filename=?);',
- undef, $event, $filename)
- or dberror($r, "Couldn't prune fake_files");
- $dbh->do('INSERT INTO fake_files (event,filename,expires_at) VALUES (?,?,now() + interval \'30 seconds\');',
- undef, $event, $filename)
- or dberror($r, "Couldn't add file");
- $r->content_type('text/plain; charset="utf-8"');
- $r->status(201);
- $r->print("OK");
- $r->log->info("Fake upload of $event/$filename");
- return Apache2::Const::OK;
+ if ($size == 0 || $filename =~ /^\.(_|DS_Store)/) {
+ $dbh->do('DELETE FROM fake_files WHERE expires_at <= now() OR (event=? AND vhost=? AND filename=?);',
+ undef, $event, Sesse::pr0n::Common::get_server_name($r), $filename)
+ or return dberror($r, "Couldn't prune fake_files");
+ $dbh->do('INSERT INTO fake_files (vhost,event,filename,expires_at) VALUES (?,?,?,now() + interval \'1 day\');',
+ undef, Sesse::pr0n::Common::get_server_name($r), $event, $filename)
+ or return dberror($r, "Couldn't add file");
+ $res->content_type('text/plain; charset="utf-8"');
+ $res->status(201);
+ $res->body("OK");
+ Sesse::pr0n::Common::log_info($r, "Fake upload of $event/$filename");
+ return $res;