Closed oliversalzburg closed 5 years ago
Why close @oliversalzburg did you add this your multiple cache PR?
@tryhardest The existing implementation was too problematic to serve our specific use case and fixing the issues we experienced without introducing breakging changes proofed challenging. So I ended up implementing what I needed in our fork.
I believe the relevant change is https://github.com/fairmanager-cordova/imgcache.js/commit/8694d6a9b94895c81fdf508923edb1ed2fd05b27
2+ weeks of work right here to determine that;
On iOS, the problem is the version of imgcache. The latest is 2.1.1, and using that with webview 2.5.2, the map crashes with custom avatar. Reverting to imgcache version 2.0.0 (which is what we used previously), causes the map avatar to show without the map crashing on iOS. On Android, reverting imgcache alone doesn't fix the problem. Reverting from webview plugin version 2.5.2 to 2.5.1 ixes the issue (map avatar shows and app doesn't crash). However, reverting to 2.4.0 didn't fix the issue. This may explain why some older builds didn't work that formerly did, until we were using webview plugin version 2.4.0.
Thanks for your reply.
When the image src URL points to a resource where a query is responded to with an HTTP redirect and using the file-transfer Cordova plugin, the plugin will not work as desired.
file-transfer is not capable of following redirects, so the HTTP 304 redirect response is persisted to the cache and future requests will return that data, instead of the image.
This is not a problem in the browser, as the browser will follow redirects.
The solution could be to construct an XHR HEAD request to follow the redirect and then use the resulting URL to retrieve the image. I have a rough implementation of that and would open a PR if there is interested in merging this here.
I would have opened a PR right away, but it's a bit tricky while I'm still working on the multiple caches thing.