Revision: 2660
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2660&view=rev
Author:   hofman
Date:     2007-08-14 10:50:41 -0700 (Tue, 14 Aug 2007)

Log Message:
-----------
Check for "://" before trying to create a URL from an arbitrary string on the 
pasteboard.

Modified Paths:
--------------
    trunk/NSURL_SKExtensions.m

Modified: trunk/NSURL_SKExtensions.m
===================================================================
--- trunk/NSURL_SKExtensions.m  2007-08-14 15:21:11 UTC (rev 2659)
+++ trunk/NSURL_SKExtensions.m  2007-08-14 17:50:41 UTC (rev 2660)
@@ -51,9 +51,11 @@
         theURL = [NSURL URLWithString:[pasteboard 
stringForType:SKWeblocFilePboardType]];
     } else if ([pboardType isEqualToString:NSStringPboardType]) {
         NSString *string = [[pasteboard stringForType:NSStringPboardType] 
stringByTrimmingCharactersInSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet]];
-        if ([string hasPrefix:@"<"] && [string hasSuffix:@">"])
-            string = [string substringWithRange:NSMakeRange(1, [string length] 
- 2)];
-        theURL = [NSURL URLWithString:string];
+        if ([string rangeOfString:@"://"].length) {
+            if ([string hasPrefix:@"<"] && [string hasSuffix:@">"])
+                string = [string substringWithRange:NSMakeRange(1, [string 
length] - 2)];
+            theURL = [NSURL URLWithString:string];
+        }
         if (theURL == nil) {
             if ([string hasPrefix:@"~"])
                 string = [string stringByExpandingTildeInPath];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to