cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Sawatzky (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-4952) resolveLocalFileSystemURI returns SECURITY_ERROR wrongly in iOS
Date Mon, 06 Jan 2014 18:21:57 GMT

    [ https://issues.apache.org/jira/browse/CB-4952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13863173#comment-13863173
] 

Jeff Sawatzky edited comment on CB-4952 at 1/6/14 6:20 PM:
-----------------------------------------------------------

Is anything happening with this?

This was happening when I take a picture using the Camera plugin (which returns a uri beginning
with "/private"), and then trying to resolveLocalFileSystemURI to get the fileEntry so that
I can get the fullPath to send to the FileTransfer.

If you don't like the provided solution then a different one would be to use [URLByResolvingSymlinksInPath|https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html#//apple_ref/occ/instm/NSURL/URLByResolvingSymlinksInPath]

{code:title=CDVFile.m (line 223)}
-    NSURL* testUri = [NSURL URLWithString:strUri];
+    NSURL* testUri = [[NSURL URLWithString:strUri] URLByResolvingSymlinksInPath];
{code}


was (Author: niltz):
Is anything happening with this?

This was happening when I take a picture using the Camera plugin, and then trying to resolveLocalFileSystemURI
to get the fileEntry so that I can get the fullPath to send to the FileTransfer.

> resolveLocalFileSystemURI returns SECURITY_ERROR wrongly in iOS
> ---------------------------------------------------------------
>
>                 Key: CB-4952
>                 URL: https://issues.apache.org/jira/browse/CB-4952
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugin File
>    Affects Versions: 3.0.0
>         Environment: iOS
>            Reporter: Kuan Yi Ming
>            Assignee: Ian Clelland
>
> The simplified version of resolveLocalFileSystemURI in the 3.0.0 file plugin doesn't
properly check the URI if it's in the tmp or Documents folder and returns FileError.SECURITY_ERROR
instead. This doesn't occur in 2.9.0.
> For example, trying to resolve a URI of a video file from using getPicture().
> Calling the following lines in CDVFile.m using the above example:
> {code:java}
> NSLog(@"url path: %@", path);
> NSLog(@"docs path: %@", self.appDocsPath);
> NSLog(@"temp path: %@", self.appTempPath);
> {code}
> returns these:
> url path: /private/var/mobile/Applications/[app id]/tmp//trim.TpPlJN.MOV
> docs path: /var/mobile/Applications/[app id]/Documents
> temp path: /var/mobile/Applications/[app id]/tmp
> Since the security error check uses hasPrefix against self.appDocsPath and self.appTempPath
here, it fails the check.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message