Revision: 29574
http://sourceforge.net/p/bibdesk/svn/29574
Author: hofman
Date: 2025-09-11 14:46:04 +0000 (Thu, 11 Sep 2025)
Log Message:
-----------
use newer method to get http headr when available
Modified Paths:
--------------
trunk/bibdesk/BDSKTextImportController.m
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2025-09-11 14:26:50 UTC (rev
29573)
+++ trunk/bibdesk/BDSKTextImportController.m 2025-09-11 14:46:04 UTC (rev
29574)
@@ -951,8 +951,17 @@
[self webView:aWebView didFailNavigation:navigation withError:error];
}
+static inline NSString *contentDispositionHeader(NSURLResponse *response) {
+ if ([response isKindOfClass:[NSHTTPURLResponse class]] == NO)
+ return nil;
+ else if (@available(macOS 10.15, *))
+ return [(NSHTTPURLResponse *)response
valueForHTTPHeaderField:@"Content-Disposition"];
+ else
+ return [[(NSHTTPURLResponse *)response allHeaderFields]
objectForKey:@"Content-Disposition"];
+}
+
- (void)webView:(WKWebView *)aWebView
decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse
decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler {
- if ([navigationResponse canShowMIMEType] && ([navigationResponse
isKindOfClass:[NSHTTPURLResponse class]] == NO || [[[(NSHTTPURLResponse
*)navigationResponse allHeaderFields] objectForKey:@"Content-Disposition"]
hasPrefix:@"attachment"] == NO)) {
+ if ([navigationResponse canShowMIMEType] &&
[contentDispositionHeader([navigationResponse response])
hasPrefix:@"attachment"] == NO) {
decisionHandler(WKNavigationResponsePolicyAllow);
} else if (@available(macOS 11.3, *)) {
decisionHandler(WKNavigationResponsePolicyDownload);
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