mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bug in OEBWriter that could cause writing out of resources in subdirectories with URL unsafe names to fail
This commit is contained in:
parent
1318348d57
commit
fd70e44ecb
@ -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 = []
|
||||
|
@ -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:
|
||||
|
@ -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 "<p> För hjälp se: <a href=\"%s\"> Användarhandbok </ a> <br>"
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/ui.py:224
|
||||
msgid "<b>%s</b>: %s by <b>Kovid Goyal %%(version)s</b><br>%%(device)s</p>"
|
||||
msgstr ""
|
||||
"<b>%s </ b>:%s av <b> Kovid Goyal%% (version) s </ b> <br>%% (enhet) s </ p>"
|
||||
"<b>%s </ b>:%s av <b> Kovid Goyal %%(version)s </ b> <br>%%(device)s </ p>"
|
||||
|
||||
#: /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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user