Revision: 27238
          http://sourceforge.net/p/bibdesk/svn/27238
Author:   hofman
Date:     2022-01-18 14:51:34 +0000 (Tue, 18 Jan 2022)
Log Message:
-----------
No need to add initial range to indexes, check for >1

Modified Paths:
--------------
    trunk/bibdesk/BibItem+Scripting.m

Modified: trunk/bibdesk/BibItem+Scripting.m
===================================================================
--- trunk/bibdesk/BibItem+Scripting.m   2022-01-17 15:48:15 UTC (rev 27237)
+++ trunk/bibdesk/BibItem+Scripting.m   2022-01-18 14:51:34 UTC (rev 27238)
@@ -671,17 +671,15 @@
             [command setScriptErrorString:@"Invalid linked file index."];
             return nil;
         }
-        if (location && (end > start || [indexes count] > 0)) {
+        if (location && (end > start || [indexes count] > 1)) {
             [command 
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
             [command setScriptErrorString:@"Only a single linked file can be 
moved to a given location."];
             return nil;
         }
-        if (indexes) {
-            [indexes addIndexesInRange:NSMakeRange(start, end + 1 - start)];
+        if (indexes)
             linkedFiles = [linkedFiles objectsAtIndexes:indexes];
-        } else if (start > 0 || end < count - 1) {
+        else if (start > 0 || end < count - 1)
             linkedFiles = [linkedFiles subarrayWithRange:NSMakeRange(start, 
end + 1 - start)];
-        }
     }
     
     if (location) {
@@ -798,15 +796,12 @@
             [command setScriptErrorString:@"Invalid linked URL index."];
             return nil;
         }
-        if (indexes) {
-            [indexes addIndexesInRange:NSMakeRange(start, end + 1 - start)];
+        if (indexes)
             linkedURLs = [linkedURLs objectsAtIndexes:indexes];
-        } else if (start > 0 || end < count - 1) {
+        else if (start > 0 || end < count - 1)
             linkedURLs = [linkedURLs subarrayWithRange:NSMakeRange(start, end 
+ 1 - start)];
-        }
-        for (BDSKLinkedFile *linkedURL in linkedURLs) {
+        for (BDSKLinkedFile *linkedURL in linkedURLs)
             [self downloadLinkedFile:linkedURL replace:replace];
-        }
     } else {
         if ([self remoteURLForField:field] == nil) {
             [command setScriptErrorNumber:NSArgumentsWrongScriptError];

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