lovelyelfpop opened a new issue, #525:
URL: https://github.com/apache/cordova-plugin-file/issues/525

   # Bug Report
   
   ## Problem
   resolveLocalFileSystemURL a content uri get FileError 
   
   
   ### What is expected to happen?
   ```javascript
   
window.resolveLocalFileSystemURL('content://com.android.providers.media.documents/document/image%3A189210',
 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
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   
   
   
   ## Reason
   The code below inside function `toNativeUri` in 
`org\apache\cordova\file\ContentFilesystem.java`
   ```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:
   ```java
   String encodedPath = inputURL.uri.getEncodedPath();
   String authorityAndPath = 
encodedPath.substring(encodedPath.indexOf(this.name) + 1 + this.name.length() + 
2);
   ```
   
   


-- 
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