Fix bug with special chars in filenames
When exporting svg, if an image file name contains a "&", it will be escaped as "&" following html encoding. But when then asked to embed the png into the svg for export, the file won't be found with the sequence escaped. The solution is to unescape (using html.parser.unescape) the line before extracting the png url.master
parent
44aa8cb9c1
commit
53429428e9
|
@ -1,4 +1,5 @@
|
|||
import base64
|
||||
import html
|
||||
import io
|
||||
import os
|
||||
import subprocess
|
||||
|
@ -57,6 +58,7 @@ def generate_outfile(
|
|||
|
||||
if ( l.startswith("xlink:href=\"file://")
|
||||
and l.endswith(".png\"") ):
|
||||
l = html.parser.unescape(l)
|
||||
image_url = urllib.parse.urlparse(
|
||||
"=".join( l.split("=")[1:] )[1:-1],
|
||||
)
|
||||
|
@ -234,6 +236,7 @@ def generate_pic(
|
|||
|
||||
if ( l.startswith("xlink:href=\"")
|
||||
and l.endswith(".png\"") ):
|
||||
l = html.parser.unescape(l)
|
||||
image_url = urllib.parse.urlparse(
|
||||
"=".join( l.split("=")[1:] )[1:-1],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue