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

Ian Clelland commented on CB-5721:
----------------------------------

I've added a test for exactly this; the app shouldn't crash (I haven't seen it 
do that, but the test is there now, and ensures that the return value is 
correct).

I also created CB-5960 to test the proper behaviour of file references above 
the root of the filesystem.

After some discussions with Kinuko Yasuda, I added checks in Android and iOS to 
ensure that you can't traverse the filesystem above the root. The parent of the 
root of the filesystem is itself, so "../resolve.file.uri" should now resolve 
to the same file as "/resolve.file.uri"


> App crashed if invoke root.getFile() and use "../resolve.file.uri" as 
> fileNames!
> --------------------------------------------------------------------------------
>
>                 Key: CB-5721
>                 URL: https://issues.apache.org/jira/browse/CB-5721
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, mobile-spec, Plugin File
>    Affects Versions: 3.2.0
>         Environment: cordova version: 3.3.1-0.1.2
>            Reporter: glmnbeyond
>            Assignee: Ian Clelland
>
> Here are the steps to reproduce it:
>    
>     $ cordova create testFile
>     $ cd testFile
>     $ cordova platform add ios
>     $ cordova platform plugin add 'cordova-plugin-file dev branch code'
> 1. Copy cordova-mobile-spec tests to testFile/platforms/ios/www/
> 2. Modify file.tests.js file.spec.9, change fileName from "resolve.file.uri" 
> to "../resolve.file.uri"
> {color:red}
>     var fileName = "resolve.file.uri"   =====>   var fileName = 
> "../resolve.file.uri"
> {color}
> 3. Run this test and app crashed! The outputs were shown as follows:
> Terminating app due to uncaught exception 'NSInvalidArgumentException', 
> reason: setObjectForKey: object cannot be nil (key: fullPath)'



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

Reply via email to