Describe the bug
When there is a newline in a data url in an image href like in #262 , the data url is not recognized and image processing fails with the creation of an invalid URL.
To Reproduce
Steps to reproduce the behavior:
With an SVG like the following where the data-url in an image has new lines in the attribute:
Conversion will fail because the data url is not recognized
Expected behavior
Browsers are more lenient with respect to data urls. XML parsers will treat new lines as spaces and browsers simply remove these white space from the base64 url before parsing it. Svg2pdf should ideally do the same.
This seems to be in accordance to the following data-url specs and implementations:
RFC2045MDN
Additional context
The Regex in the code that handles data urls does not consider this additional whitespace and hence processing continues with the wrong steps. Sanitizing/minifying the SVG by removing the whitespace from the data urls fixes the issue like in #262
Describe the bug When there is a newline in a data url in an image href like in #262 , the data url is not recognized and image processing fails with the creation of an invalid URL.
To Reproduce Steps to reproduce the behavior:
With an SVG like the following where the data-url in an image has new lines in the attribute:
Conversion will fail because the data url is not recognized
Expected behavior Browsers are more lenient with respect to data urls. XML parsers will treat new lines as spaces and browsers simply remove these white space from the base64 url before parsing it. Svg2pdf should ideally do the same.
This seems to be in accordance to the following data-url specs and implementations: RFC2045 MDN
Additional context The Regex in the code that handles data urls does not consider this additional whitespace and hence processing continues with the wrong steps. Sanitizing/minifying the SVG by removing the whitespace from the data urls fixes the issue like in #262