Android-Universal-Image-Loader: De/Encoding for File URI image load problem

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, "@#&=*+-_.,:!?()/~'%");
        ...
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted 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”