mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Switch '..'-removal logic to code more likely to play nice on Windows
This commit is contained in:
parent
56b5b0e26c
commit
0d2c447846
@ -334,14 +334,9 @@ class ManifestItem(object):
|
|||||||
self.root = root
|
self.root = root
|
||||||
self.state = state
|
self.state = state
|
||||||
# Some paths in Fictionwise "multiformat" LIT files contain '..' (!?)
|
# Some paths in Fictionwise "multiformat" LIT files contain '..' (!?)
|
||||||
nodes = original.split('/')
|
path = os.path.normpath(original).replace('\\', '/')
|
||||||
path = []
|
while path.startswith('../'): path = path[3:]
|
||||||
for node in nodes:
|
self.path = path
|
||||||
if node == '..':
|
|
||||||
if path: path.pop()
|
|
||||||
continue
|
|
||||||
path.append(node)
|
|
||||||
self.path = os.path.join(*path)
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if hasattr(other, 'internal'):
|
if hasattr(other, 'internal'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user