From dce39bb6fe12a50b367fccae88b5e79aa2daeaa3 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Tue, 20 Feb 2007 03:15:12 +0000 Subject: [PATCH] fix the order of searching for linked image file to match that of inkscape itself: first href, only if it fails absref --- share/extensions/embedimage.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py index 81380c165..5277f0fa4 100644 --- a/share/extensions/embedimage.py +++ b/share/extensions/embedimage.py @@ -51,21 +51,22 @@ class MyEffect(inkex.Effect): path='' #path selection strategy: - # 1. absref - # 2. href if absolute - # 3. sodipodi:docbase + href - # 4. realpath-ified href - if (absref != None): - path=absref.value - elif (href != None): + # 1. href if absolute + # 2. sodipodi:docbase + href + # 3. realpath-ified href + # 4. absref, only if the above does not point to a file + if (href != None): if (os.path.isabs(href.value)): path=os.path.realpath(href.value) elif (docbase != None): path=os.path.join(docbase.value,href.value) else: path=os.path.realpath(href.value) - else: - inkex.debug('No xlink:href or sodipodi:absref attributes found! Unable to embed image.') + if (not os.path.isfile(path)): + if (absref != None): + path=absref.value + if (not os.path.isfile(path)): + inkex.debug('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.') if (os.path.isfile(path)): file = open(path,"rb").read() -- 2.30.2