From: Mike Gelfand Date: Fri, 23 Oct 2015 18:53:47 +0000 (+0000) Subject: #5777: Trim potential URIs from clipboard on Mac (patch by jeepston, a bit modified) X-Git-Tag: 2.90~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8392476b30491ffe7d8d64210f5cf3c3dd1d69ca;p=transmission #5777: Trim potential URIs from clipboard on Mac (patch by jeepston, a bit modified) --- diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 7750b0ec4..03c753eca 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -556,6 +556,7 @@ 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 @@ -586,6 +587,7 @@ 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;