From: Steinar H. Gunderson Date: Wed, 9 Aug 2006 21:40:35 +0000 (+0200) Subject: Unlink all failed uploads. X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=1b419e82260d4c5135c1f6a202e2dccd9cfbde43;ds=sidebyside Unlink all failed uploads. --- diff --git a/perl/Sesse/pr0n/WebDAV.pm b/perl/Sesse/pr0n/WebDAV.pm index 2a974e2..08f4c7b 100644 --- a/perl/Sesse/pr0n/WebDAV.pm +++ b/perl/Sesse/pr0n/WebDAV.pm @@ -456,8 +456,8 @@ EOF { # Enable transactions and error raising temporarily local $dbh->{AutoCommit} = 0; - local $dbh->{RaiseError} = 1; + my $fname; # Try to insert this new file eval { @@ -468,7 +468,7 @@ EOF undef, $newid, $event, $user, $takenby, $filename); # Now save the file to disk - my $fname = Sesse::pr0n::Common::get_disk_location($r, $newid); + $fname = Sesse::pr0n::Common::get_disk_location($r, $newid); open NEWFILE, ">$fname" or die "$fname: $!"; @@ -499,6 +499,7 @@ EOF # Some error occurred, rollback and bomb out $dbh->rollback; dberror($r, "Transaction aborted because $@"); + unlink($fname); } }