-
Notifications
You must be signed in to change notification settings - Fork 759
Closed
Labels
Description
Bug Report
Problem
resolveLocalFileSystemURL a content uri get FileError
What is expected to happen?
const uri = 'content://com.android.providers.media.documents/document/image%3A189210';
// or
// const uri = 'https://localhost/__cdvfile_content__/com.android.providers.media.documents/document/image%3A189210';
window.resolveLocalFileSystemURL(uri, function (fileEntry) {
console.log(fileEntry);
}, function(err) {
console.log(err)
});
It got a FileError (code 1, not found)
What does actually happen?
It should log the fileEntry in the console
Information
Environment, Platform, Device
Redmi K30 pro, Android 11
Version information
[email protected]
[email protected]
[email protected]
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Reason
The code below inside function toNativeUri
in org\apache\cordova\file\ContentFilesystem.java
String authorityAndPath = inputURL.uri.getEncodedPath().substring(this.name.length() + 2);
got e_content__/com.android.providers.media.documents/document/image%3A189210
It should be
com.android.providers.media.documents/document/image%3A189210
The right code is:
String encodedPath = inputURL.uri.getEncodedPath();
String authorityAndPath = encodedPath.substring(encodedPath.indexOf(this.name) + 1 + this.name.length() + 2);
ollm, rastafan, secretmoo35, nicolashenry and mirko77