From 29e133c61a9f6d813b4137fd94f4c8305c4de4f5 Mon Sep 17 00:00:00 2001 From: Li Fanxi Date: Mon, 11 Oct 2010 00:41:24 +0800 Subject: [PATCH] [SNBOutput] Fixed a bug in image path handling. --- src/calibre/ebooks/snb/snbml.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/snb/snbml.py b/src/calibre/ebooks/snb/snbml.py index bfdaf53cae..72600fa4d2 100644 --- a/src/calibre/ebooks/snb/snbml.py +++ b/src/calibre/ebooks/snb/snbml.py @@ -99,7 +99,13 @@ class SNBMLizer(object): line = line.strip(' \t\n\r') if len(line) != 0: if line.find(CALIBRE_SNB_IMG_TAG) == 0: - etree.SubElement(trees[subitem].find(".//body"), "img").text = line[len(CALIBRE_SNB_IMG_TAG):] + prefix = ProcessFileName(os.path.dirname(self.item.href)) + if prefix != '': + etree.SubElement(trees[subitem].find(".//body"), "img").text = \ + prefix + '_' + line[len(CALIBRE_SNB_IMG_TAG):] + else: + etree.SubElement(trees[subitem].find(".//body"), "img").text = \ + line[len(CALIBRE_SNB_IMG_TAG):] elif line.find(CALIBRE_SNB_BM_TAG) == 0: subitem = line[len(CALIBRE_SNB_BM_TAG):] else: