From 1b419e82260d4c5135c1f6a202e2dccd9cfbde43 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 9 Aug 2006 23:40:35 +0200 Subject: [PATCH] Unlink all failed uploads. --- perl/Sesse/pr0n/WebDAV.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } } -- 2.39.2