Android image ng-src started to appear broken after some update

I did no changes to my app code, but some update in the last couple of days to android apps caused the images shown using dataURLs for ng-src started to appear as if the link was broken.

It first manifested on my Nexus 5. At the same time, the same code was working on on my Galaxy Tab A. Then the Galaxy tab updated some apps. While it was doing so, my Ionic app auto closed. I restarted it and the images started to show as broken links there too.

As weird as this sounds, I am not able to explain it any other way due to the observations and the fact that there was no change made to the code.

Any guesses?

Anuj

Can you try to debug your app through the Chrome inspect tool (chrome://inspect) and see what is the error? thanks

Thank you very much for that. I was able to see the error, which is:

Refused to load the image ‘data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAEBAQEBAQEBAQEBAQEBA…eIim1Nta1KUnFqlOo63OuSXsXFzPPqUnTdKvTkrw5bc8eb34SUuWUre7zcsoysm9bo/wD/2Q==’ because it violates the following Content Security Policy directive: “default-src *”. Note that ‘img-src’ was not explicitly set, so ‘default-src’ is used as a fallback.

My CSP is set as

http-equiv=“Content-Security-Policy” content=“default-src *; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’”

I have had this from the very beginning based on a couchbase mobile tutorial at http://blog.couchbase.com/using-couchbase-in-your-ionic-framework-application-part-1

The application has worked all along, but just started failing.

I am a novice at CSP. Any help?

Thanks,

Anuj

Ok, I solved for it for now by adding the following to my CSP:
img-src ‘self’ data:

However, I am still curious to know, why it just started to fail when it was working earlier.

1 Like

cool, hmm, what I do know about CSP is that by default and for security purposes
Cordova Whitelist Plugin prevents the app the access external link(s) or source(s), therefore it prevents you from displaying the image…

hi, i’m having the same problem. you’ve just add “img-src ‘self’ data:” and it worked out?