Denis Babineau created CB-9991:
----------------------------------

             Summary: resolveLocalFileSystemURL returns extra leading slash in 
nativeURL for some paths
                 Key: CB-9991
                 URL: https://issues.apache.org/jira/browse/CB-9991
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS, Plugin File
            Reporter: Denis Babineau


The following:

window.resolveLocalFileSystemURL(cordova.file.applicationDirectory, function(e) 
{ console.log("OK:", e); }, function(e) { console.log("ERR:", e); });

returns an object with nativeURL that looks like this (notice the 4 slashes 
past the protocol, should be 3 slashes):

"file:////var/mobile/Containers/Bundle/Application/EC6F4A71-B8A8-4156-A43B-C7CB4F39FA19/Test.app/"

I narrowed it down to CDVLocalFilesystem.m's filesystemPathForFullPath 
implementation not handling extra leading slashes properly when fsRoot == '/':

- (NSString *)filesystemPathForFullPath:(NSString *)fullPath
{
    NSString *path = nil;
    NSString *strippedFullPath = [self stripQueryParametersFromPath:fullPath];
    path = [NSString stringWithFormat:@"%@%@", self.fsRoot, strippedFullPath];
    if ([path length] > 1 && [path hasSuffix:@"/"]) {
      path = [path substringToIndex:([path length]-1)];
    }
    return path;
}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to