cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject git commit: CB-4952: ios: Resolve symlinks in file:// URLs
Date Mon, 03 Mar 2014 15:45:16 GMT
Repository: cordova-plugin-file
Updated Branches:
  refs/heads/dev 82220330b -> ee04e5c7c


CB-4952: ios: Resolve symlinks in file:// URLs


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/ee04e5c7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/ee04e5c7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/ee04e5c7

Branch: refs/heads/dev
Commit: ee04e5c7c524b4bfcdd9a4f33475fc5a5c2c93b3
Parents: 8222033
Author: Ian Clelland <iclelland@chromium.org>
Authored: Mon Mar 3 10:44:52 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Mon Mar 3 10:44:52 2014 -0500

----------------------------------------------------------------------
 src/ios/CDVFile.m | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/ee04e5c7/src/ios/CDVFile.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index fa4a0a2..d36fbe6 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -426,20 +426,9 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
     /* Backwards-compatibility: Check for file:// urls */
     if ([localURIstr hasPrefix:@"file://"]) {
         /* This looks like a file url. Get the path, and see if any handlers recognize it.
*/
-        NSString* path;
-        NSRange questionMark = [localURIstr rangeOfString:@"?"];
-        NSUInteger pathEnd;
-        if (questionMark.location == NSNotFound) {
-            pathEnd = localURIstr.length;
-        } else {
-            pathEnd = questionMark.location;
-        }
-        NSRange thirdSlash = [localURIstr rangeOfString:@"/" options:0 range:(NSRange){7,
pathEnd-7}];
-        if (thirdSlash.location == NSNotFound) {
-            path = @"";
-        } else {
-            path = [localURIstr substringWithRange:NSMakeRange(thirdSlash.location, pathEnd-thirdSlash.location)];
-        }
+        NSURL *fileURL = [NSURL URLWithString:localURIstr];
+        NSURL *resolvedFileURL = [fileURL URLByResolvingSymlinksInPath];
+        NSString *path = [resolvedFileURL path];
         inputURI = [self fileSystemURLforLocalPath:path];
     } else {
         inputURI = [CDVFilesystemURL fileSystemURLWithString:localURIstr];


Mime
View raw message