breautek opened a new issue, #1496:
URL: https://github.com/apache/cordova-android/issues/1496

   
https://github.com/apache/cordova-android/blob/954d3e0e7542356e6ea995ddc75dcb1db8bb36cc/framework/src/org/apache/cordova/CordovaResourceApi.java#L149-L173
   
   The `cordova-plugin-file-transfer` plugin utilizes this method to map a uri 
value such as `http://localhost/__cdvfile_persistent__/testFile.txt` to a local 
file url, when using the file transfer's download API. However because this API 
does not handle the `http` scheme, it returns a Null, which eventually leads to 
a `NullPointerException` and failing unit tests.
   
   the `testFile.txt` url comes from the [following 
code](https://github.com/apache/cordova-plugin-file-transfer/blob/2465f508adfadd5be4a8ea9ecd1ca01779164ea2/tests/tests.js#L333-L335):
   
   ```javascript
   this.root = this.persistentRoot;
   this.fileName = 'testFile.txt';
   this.localFilePath = this.root.toURL() + this.fileName;
   ```
   Where `this.persistentRoot` [resolved 
by](https://github.com/apache/cordova-plugin-file-transfer/blob/2465f508adfadd5be4a8ea9ecd1ca01779164ea2/tests/tests.js#L215-L225):
   
   ```javascript
   window.requestFileSystem(
       LocalFileSystem.PERSISTENT,
       DEFAULT_FILESYSTEM_SIZE,
       function (fileSystem) {
           specContext.persistentRoot = fileSystem.root;
           done();
       },
       function () {
           throw new Error('Failed to initialize persistent file system.');
       }
   );
   ```
   
   I'm raising the issue here because the method in question is located inside 
cordova-android, but it's unclear if the solution is to update `mapUriToFile` 
support this use case, or if the file transfer plugin should expect `file://` 
urls instead of http:// urls.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to