]> granicus.if.org Git - transmission/commitdiff
#5777: Trim potential URIs from clipboard on Mac (patch by jeepston, a bit modified)
authorMike Gelfand <mikedld@mikedld.com>
Fri, 23 Oct 2015 18:53:47 +0000 (18:53 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Fri, 23 Oct 2015 18:53:47 +0000 (18:53 +0000)
macosx/TorrentTableView.m

index 7750b0ec4e5c77b4d7d4cb491ea9a506f5845d37..03c753eca24bf89fda96c8af47b06754d3f830b8 100644 (file)
             NSDataDetector * detector = [NSDataDetectorLion dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
             for (NSString * pbItem in items)
             {
+                pbItem = [pbItem stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
                 if ([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
                     [fController openURL: pbItem];
                 else
                 NSDataDetector * detector = [NSDataDetectorLion dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
                 for (NSString * pbItem in items)
                 {
+                    pbItem = [pbItem stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
                     if (([pbItem rangeOfString: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)].location != NSNotFound)
                         || [detector firstMatchInString: pbItem options: 0 range: NSMakeRange(0, [pbItem length])])
                         return YES;