From 0d2c447846bb87ea5cbaf9fe06329cc4a7b4ff5e Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Sun, 20 Jul 2008 08:51:38 -0400 Subject: [PATCH] Switch '..'-removal logic to code more likely to play nice on Windows --- src/calibre/ebooks/lit/reader.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index 8cef0fdd18..583c621a55 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -334,14 +334,9 @@ class ManifestItem(object): self.root = root self.state = state # Some paths in Fictionwise "multiformat" LIT files contain '..' (!?) - nodes = original.split('/') - path = [] - for node in nodes: - if node == '..': - if path: path.pop() - continue - path.append(node) - self.path = os.path.join(*path) + path = os.path.normpath(original).replace('\\', '/') + while path.startswith('../'): path = path[3:] + self.path = path def __eq__(self, other): if hasattr(other, 'internal'):