Revision: 29990
          http://sourceforge.net/p/bibdesk/svn/29990
Author:   hofman
Date:     2026-02-14 18:32:53 +0000 (Sat, 14 Feb 2026)
Log Message:
-----------
get suggested filename from decideDestinationWithSuggestedFilename:, but don't 
use setDestination:allowOverwrite:

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

Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2026-02-14 18:06:30 UTC (rev 29989)
+++ trunk/bibdesk/BDSKDownloadManager.m 2026-02-14 18:32:53 UTC (rev 29990)
@@ -373,22 +373,7 @@
 
 - (void)downloadDidFinish:(NSURLDownload *)download {
     BDSKWebDownload *webDownload = [downloadManager 
webDownloadForDownload:download];
-    
     NSString *filename = [webDownload suggestedFilename];
-    
-    NSString *disposition = [[download request] 
valueForHTTPHeaderField:@"Content-Disposition"];
-    if ([disposition hasPrefix:@"attachment; filename*=UTF-8''"]) {
-        disposition = [disposition substringFromIndex:29];
-        if ([disposition length])
-            filename = [disposition stringByRemovingPercentEncoding];
-    } else if ([disposition hasPrefix:@"attachment; filename="]) {
-        disposition = [disposition substringFromIndex:21];
-        if ([disposition hasPrefix:@"\""] && [disposition hasSuffix:@"\""])
-            disposition = [disposition substringWithRange:NSMakeRange(1, 
[disposition length] - 2)];
-        if ([disposition length])
-            filename = disposition;
-    }
-    
     NSURL *tmpFileURL = [webDownload tempFileURL];
     [webDownload setTempFileURL:nil];
     
@@ -409,14 +394,13 @@
     [downloadManager download:download didCompleteWithError:error];
 }
 
-- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse 
*)response {
-    [[downloadManager webDownloadForDownload:download] 
setSuggestedFilename:[response suggestedFilename]];
+- (void)download:(NSURLDownload *)download 
decideDestinationWithSuggestedFilename:(NSString *)filename {
+    // delay actual destination choice, as this is not functional (anymore)
+    // with a non-sync NSSavePanel the download never waited for it to finish,
+    // but even with -runModal, WebDownload seems to ignore 
-setDestination:allowOverwrite:
+    [[downloadManager webDownloadForDownload:download] 
setSuggestedFilename:filename];
 }
 
-// -download:decideDestinationWithSuggestedFilename: is not functional 
(anymore)
-// with a non-sync NSSavePanel the download never waited for it to finish,
-// but even with -runModal WebDownload ignores -setDestination:allowOverwrite:
-
 - (void)download:(NSURLDownload *)download didCreateDestination:(NSString 
*)path {
     [[downloadManager webDownloadForDownload:download] setTempFileURL:[NSURL 
fileURLWithPath:path isDirectory:NO]];
 }

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