imgcache.js icon indicating copy to clipboard operation
imgcache.js copied to clipboard

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

Open afeezaziz opened this issue 7 years ago • 4 comments

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?

afeezaziz avatar Apr 01 '17 17:04 afeezaziz

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

demonVibe avatar Apr 14 '17 06:04 demonVibe

@demonVibe 's fix worked for me. Thanks!

wstrinz avatar Sep 12 '17 17:09 wstrinz

Thanks @demonVibe you save my day

khouleBousso avatar Dec 12 '17 21:12 khouleBousso

Thanks @demonVibe , you save my day.

darwiin avatar Mar 13 '18 22:03 darwiin