-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG errors not surfaced in onError callback #2798
Comments
Is it possible to detect that a parsing exception has occurred? According to the code snippet you linked it looks like the library catches those exceptions and only calls |
Not to my knowledge. When the error occurs internally the ruleset variable is set to null. This is not necessarily an error since style in an SVG is optional. I put together a simplified demo project (https://github.com/jocmp/svgdebug) to display the difference in output for the library between the SVG with the media selector and without it. The SVG without the media selector displays correctly in a red box. |
Thanks for the repro project. I agree we should ideally report the parsing issue to |
Makes sense. Out of curiosity, are there other SVG libraries for Android you've seen? I noticed Glide also uses androidsvg but the library hasn't had a release in 4 years. |
Describe the bug
I author an RSS reader that integrates with a service called FreshRSS. FreshRSS sometimes selects a website's SVG favicon to display as an icon via their API. In most cases, websites use simple SVGs. However some cases like the one below, the SVG may contain CSS that cannot be parsed by Coil.
For example, SVGs that contain media queries error but don't call the
onError
callback. Given the following test SVG (https://www.faz.net/favicon.svg) that includes this CSS, the SVG is not displayed.Image
This is a noted constraint in the underlying SVG library on Android (BigBadaboom/androidsvg#231) and errors on the ruleset with the following error.
Ideally the final SVG would be rendered correctly or at least call
onError
so the app code can react correctly.To Reproduce
Create an
AsyncImage
and pass the hardcoded URL of"https://www.faz.net/favicon.svg"
as the data argument.In my testing,
onError
is never called.Version
coil 2.7.0, coil-svg 2.7.0. I have not tried this on Coil 3.
The text was updated successfully, but these errors were encountered: