Revision: 27937
          http://sourceforge.net/p/bibdesk/svn/27937
Author:   hofman
Date:     2022-09-26 18:12:36 +0000 (Mon, 26 Sep 2022)
Log Message:
-----------
get search group server from URL from part of path after ; rather than from the 
parameterString, which now returns nil

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

Modified: trunk/bibdesk/BDSKSearchGroup.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroup.m     2022-09-26 16:41:58 UTC (rev 27936)
+++ trunk/bibdesk/BDSKSearchGroup.m     2022-09-26 18:12:36 UTC (rev 27937)
@@ -426,13 +426,23 @@
     NSString *aHost = [[bdsksearchURL host] stringByRemovingPercentEncoding];
     NSString *aPort = [[bdsksearchURL port] stringValue];
     NSString *path = [bdsksearchURL path];
-    NSString *aDatabase = [([path hasPrefix:@"/"] ? [path 
substringFromIndex:1] : path ?: @"") stringByRemovingPercentEncoding];
-    NSString *aName = [[bdsksearchURL parameterString] 
stringByRemovingPercentEncoding] ?: aDatabase;
+    NSString *aDatabase = nil;
+    NSString *aName = [[bdsksearchURL parameterString] 
stringByRemovingPercentEncoding];
     NSString *query = [bdsksearchURL query];
     NSString *aSearchTerm = nil;
     NSString *aType = BDSKSearchGroupZoom;
     NSMutableDictionary *options = [NSMutableDictionary dictionary];
     
+    // since 10.15 the parameter is included in the path rather than returned 
by parameterString
+    if (aName == nil) {
+        NSUInteger semicolon = [path rangeOfString:@";"].location;
+        if (semicolon != NSNotFound) {
+            path = [path substringToIndex:semicolon];
+            aName = [[path substringFromIndex:semicolon + 1] 
stringByRemovingPercentEncoding];
+        }
+    }
+    aDatabase = [([path hasPrefix:@"/"] ? [path substringFromIndex:1] : path 
?: @"") stringByRemovingPercentEncoding];
+    
     [options setValue:[[bdsksearchURL password] 
stringByRemovingPercentEncoding] forKey:@"password"];
     [options setValue:[[bdsksearchURL user] stringByRemovingPercentEncoding] 
forKey:@"username"];
     
@@ -469,7 +479,7 @@
     
     NSMutableDictionary *dictionary = [NSMutableDictionary 
dictionaryWithCapacity:7];
     [dictionary setValue:aType forKey:@"type"];
-    [dictionary setValue:aName forKey:@"name"];
+    [dictionary setValue:aName ?: aDatabase forKey:@"name"];
     [dictionary setValue:aDatabase forKey:@"database"];
     [dictionary setValue:aSearchTerm forKey:@"search term"];
     if ([aType isEqualToString:BDSKSearchGroupZoom]) {

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