From: JazzyNico Date: Mon, 22 Jun 2009 20:55:27 +0000 (+0000) Subject: Absolute path fix for bug 386664 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b7e860c6412a32bc69c8f02cc6c96f53bcd15d4b;p=inkscape.git Absolute path fix for bug 386664 --- diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py index 67cabdf22..88c294245 100644 --- a/share/extensions/svg_and_media_zip_output.py +++ b/share/extensions/svg_and_media_zip_output.py @@ -33,7 +33,7 @@ TODO - maybe add better extention """ -import inkex, os.path +import inkex, os.path, urlparse, urllib import os import string import zipfile @@ -94,9 +94,14 @@ class SVG_and_Media_ZIP_Output(inkex.Effect): def collectAndZipImages(self, node, docname, z): xlink = node.get(inkex.addNS('href',u'xlink')) if (xlink[:4]!='data'): - absref = node.get(inkex.addNS('absref',u'sodipodi')) - if absref is None: - absref = node.get(inkex.addNS('href',u'xlink')) + absref=node.get(inkex.addNS('absref','sodipodi')) + url=urlparse.urlparse(xlink) + href=urllib.unquote(url.path) + if os.name == 'nt' and href[0] == '/': + href = href[1:] + if (href != None): + absref=os.path.realpath(href) + if (os.path.isfile(absref)): shutil.copy(absref, self.tmp_dir) z.write(absref.encode("latin-1"),os.path.basename(absref).encode("latin-1"))