chrisben / imgcache.js

JS library based on the File API to cache images for offline recovery (target: cordova/phonegap & chrome)
Other
826 stars 216 forks source link

Source URL is corrupted when there is a special character in it #206

Open afeezaziz opened 7 years ago

afeezaziz commented 7 years ago

Hi,

Assuming that I have this image tag <lazy-img src="https://firebasestorage.googleapis.com/v0/b/playing-around-firebase123.appspot.com/o/bucket%2Fusers%252F3JPxuPMDxTmc5L37wc30IOVThkJ3%2Fimages%2Fpublic%2Fbox.png?alt=media&token=7533c31a-e82b-4eb8-bd12-3cce1273bc84"></lazy-img>. Every time, it will load this instead: <lazy-img src="https://firebasestorage.googleapis.com/v0/b/playing-around-firebase123.appspot.com/o/bucket%252Fusers%252F3JPxuPMDxTmc5L37wc30IOVThkJ3%252Fimages%252Fpublic%252Fbox.png?alt=media&token=7533c31a-e82b-4eb8-bd12-3cce1273bc84"></lazy-img> which means that if there is a %2f in the url, it will add 52 in between 2 and f which makes it %252f or a broken link. How can I fix this?

demonVibe commented 7 years ago

Hi @afeezaziz I stumbled upon the same issue as yours. %2f is the url encoding of /, %252f seems a double encode of the specific string. So, what you need to do is just skip the uri encoding in the plugin. There's an option for this, When you initialize the plugin in you app component you can add this line: ImgCache.options.skipURIencoding = true;

Hope this helps you fix your issue

wstrinz commented 7 years ago

@demonVibe 's fix worked for me. Thanks!

khouleBousso commented 6 years ago

Thanks @demonVibe you save my day

darwiin commented 6 years ago

Thanks @demonVibe , you save my day.