fix: image loading when using markdown img and bigImageUrl #353
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #333
When receiving a message with the same image in the markdown body and in the extras client::notification.bigImageUrl, then there is a clash on the file system.
One request succeeds and the other fails with the following error. This commit ensures that there is only one coil image loader instance, so that there shouldn't be file system race conditions.
The problem is reproducible: host a big image (20mb or more nearly trigger the bug 100%) on a server. When this message
{ "title": "Title", "message": "", "priority": 5, "extras": { "client::display": { "contentType": "text/markdown" }, "client::notification": { "bigImageUrl": "http://192.168.178.2:8000/1.jpg?v=VERSION" } } }is viewed on android, then either the bigImageUrl or the markdown image doesn't load correctly. Caching suppresses the issue, so replace VERSION with something unique, so the bug is triggered on every POST.
After this commit, I couldn't reproduce the problem anymore.