question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

De/Encoding for File URI image load problem

See original GitHub issue

For 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:closed
  • Created 11 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AristoMcommented, Mar 16, 2015

Replacing white space with %20 is working fine for me

1reaction
nostra13commented, Mar 10, 2015

You should pass “/sdcard/Android/data/my.package/files/Pictures/directory containing whitespaces/some_image.jpg”

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found