-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapUriToFile has no implementation for http
/ https
schemes
#1496
Comments
@erisu @jcesarmobile @NiklasMerz Would be interested in your feedback on this. I'm not particularly sure why the file transfer plugin is receiving a but: the |
On Crodova 10+ all FileEntry returns will only return a http url (this is toURL, toInternalURL toNativeURL) all return the same http/s based __cdvfile url, there is only one way to get the file: uri's from any of the cordova-file plugin calls via javascript and that is to use entry.nativeURL (note not toNativeURL as that will also return http based URI). Most platforms from ios to electron will support the urls correctly. So I do think it may be a good idea to add support for the new CDVfile scheme on http for android. However for my purpose I will change the passed URL to file transfer to entry.nativeURL. @breautek for your purposes change: this.root.toURL() to this.root.nativeURL |
cordova-android/framework/src/org/apache/cordova/CordovaResourceApi.java
Lines 149 to 173 in 954d3e0
The
cordova-plugin-file-transfer
plugin utilizes this method to map a uri value such ashttp://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 thehttp
scheme, it returns a Null, which eventually leads to aNullPointerException
and failing unit tests.the
testFile.txt
url comes from the following code:Where
this.persistentRoot
resolved by: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 expectfile://
urls instead of http:// urls.The text was updated successfully, but these errors were encountered: