Revision: 29987
          http://sourceforge.net/p/bibdesk/svn/29987
Author:   hofman
Date:     2026-02-14 17:05:39 +0000 (Sat, 14 Feb 2026)
Log Message:
-----------
clean up downloaded file from WebDownload when user canceled from save panel

Modified Paths:
--------------
    trunk/bibdesk/BDSKDownloadManager.m

Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2026-02-13 17:56:28 UTC (rev 29986)
+++ trunk/bibdesk/BDSKDownloadManager.m 2026-02-14 17:05:39 UTC (rev 29987)
@@ -265,6 +265,7 @@
         if (result == NSModalResponseOK) {
             BDSKWebDownload *webDownload = [self 
webDownloadForDownload:download];
             fileURL = [sPanel URL];
+            [webDownload setFileURL:fileURL];
             // if a file exists, the user should have confirmed to overwrite
             if ([fileURL checkResourceIsReachableAndReturnError:NULL]) {
                 NSURL *tmpURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:[fileURL lastPathComponent]];
@@ -271,7 +272,6 @@
                 if ([[NSFileManager defaultManager] moveItemAtURL:fileURL 
toURL:tmpURL error:NULL])
                     [webDownload setTempFileURL:tmpURL];
             }
-            [webDownload setFileURL:fileURL];
         }
         completionHandler(fileURL);
     };
@@ -398,6 +398,8 @@
             [[NSFileManager defaultManager] moveItemAtURL:tmpFileURL 
toURL:destinationURL error:&error];
         else
             error = [NSError errorWithDomain:NSURLErrorDomain 
code:NSURLErrorCancelled userInfo:nil];
+        if (error)
+            [[NSFileManager defaultManager] removeItemAtURL:tmpFileURL 
error:NULL];
         [downloadManager download:download didCompleteWithError:error];
     }];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to