De/Encoding for File URI image load problem
See original GitHub issueFor an image file: /storage/sdcard0/groupurchase/cache/http%3A%2F%2Fd2.lashouimg.com%2Fzt_mobile_220%2F201211%2F29%2F135417696321262100.jpg
imageLoader tries to load an decoded file path which is incorrect:
02-25 13:20:51.085: E/ImageLoader(27155): java.io.FileNotFoundException: /storage/sdcard0/groupurchase/cache/http:/d2.lashouimg.com/zt_mobile_220/201211/29/135417696321262100.jpg: open failed: ENOENT (No such file or directory)
It should keep the encoded string as it is, and read by stream.
The problem is caused by imageloader code below:
final class ImageLoadingInfo {
...
public ImageLoadingInfo(String uri, ImageView imageView, ImageSize targetSize, DisplayImageOptions options, ImageLoadingListener listener, ReentrantLock loadFromUriLock) {
this.uri = Uri.encode(uri, "@#&=*+-_.,:!?()/~'%");
...
}
}
Issue Analytics
- State:
- Created 11 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
File not found exception while encoding image from path
Solution 1 throws FilenotFoundexception, as per my understanding it is because not find real path. Solution 2 returns null for the same reason...
Read more >Encoded file_url causing broken image paths - Drupal
Problem /Motivation If the generated image style url contains special characters it is being encoded and returned causing broken image paths.
Read more >Cannot display image captured from camera via file_uri from ...
I have a workaround...I capture the image from the camera using file-uri, then use filereader.readasdataurl to display that image, and the file-uri to...
Read more >Data URLs - HTTP - MDN Web Docs - Mozilla
Base64 encoding of a file or string on Linux and macOS systems can be ... To mitigate such issues, top-level navigation to data:...
Read more >Uri | Android Developers
Gets the encoded fragment part of this URI, everything after the '#'. ... This method does not validate bad URI's, or 'fix' poorly...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Replacing white space with %20 is working fine for me
You should pass “/sdcard/Android/data/my.package/files/Pictures/directory containing whitespaces/some_image.jpg”