From fd70e44ecbdb1a586a01a332d050a5e3507429bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Jan 2010 14:21:54 -0700 Subject: [PATCH] Fix bug in OEBWriter that could cause writing out of resources in subdirectories with URL unsafe names to fail --- src/calibre/ebooks/oeb/base.py | 8 ++++---- src/calibre/ebooks/oeb/writer.py | 1 + src/calibre/translations/sv.po | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 96140ce195..753b1722de 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -421,16 +421,16 @@ class DirContainer(object): return f.read() def write(self, path, data): - path = os.path.join(self.rootdir, path) + path = os.path.join(self.rootdir, urlunquote(path)) dir = os.path.dirname(path) if not os.path.isdir(dir): os.makedirs(dir) - with open(urlunquote(path), 'wb') as f: + with open(path, 'wb') as f: return f.write(data) def exists(self, path): - path = os.path.join(self.rootdir, path) - return os.path.isfile(urlunquote(path)) + path = os.path.join(self.rootdir, urlunquote(path)) + return os.path.isfile(path) def namelist(self): names = [] diff --git a/src/calibre/ebooks/oeb/writer.py b/src/calibre/ebooks/oeb/writer.py index 9c7c1af48d..25365991d0 100644 --- a/src/calibre/ebooks/oeb/writer.py +++ b/src/calibre/ebooks/oeb/writer.py @@ -62,6 +62,7 @@ class OEBWriter(object): output = DirContainer(path, oeb.log) for item in oeb.manifest.values(): output.write(item.href, str(item)) + if version == 1: metadata = oeb.to_opf1() elif version == 2: diff --git a/src/calibre/translations/sv.po b/src/calibre/translations/sv.po index 13b37d9401..d072ec9d14 100644 --- a/src/calibre/translations/sv.po +++ b/src/calibre/translations/sv.po @@ -2245,7 +2245,7 @@ msgstr "" "kommando ...\n" "\n" "Kommandot kan vara något av följande:\n" -"[%% kommandon]\n" +"[%%commands]\n" "\n" "Använd %prog kommando --help för att få mer information om ett visst " "kommando\n" @@ -6213,7 +6213,7 @@ msgstr "

För hjälp se: Användarhandbok
" #: /home/kovid/work/calibre/src/calibre/gui2/ui.py:224 msgid "%s: %s by Kovid Goyal %%(version)s
%%(device)s

" msgstr "" -"%s :%s av Kovid Goyal%% (version) s
%% (enhet) s " +"%s :%s av Kovid Goyal %%(version)s
%%(device)s " #: /home/kovid/work/calibre/src/calibre/gui2/ui.py:247 msgid "Edit metadata individually" @@ -7826,9 +7826,9 @@ msgid "" "\n" "For help on an individual command: %%prog command --help\n" msgstr "" -"%% prog kommando [alternativ] [argument]\n" +"%%prog kommando [alternativ] [argument]\n" "\n" -"%% PROG är kommandoradsgränssnitt till calibres bokdatabasen.\n" +"%%prog är kommandoradsgränssnitt till calibres bokdatabasen.\n" "\n" "kommando är en av:\n" " %s\n"