mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
...
This commit is contained in:
parent
4d899142fd
commit
06e4b9e49b
@ -1181,12 +1181,6 @@ class Manifest(object):
|
|||||||
:param:`href` are `None` then the corresponding item in the return
|
:param:`href` are `None` then the corresponding item in the return
|
||||||
tuple will also be `None`.
|
tuple will also be `None`.
|
||||||
"""
|
"""
|
||||||
def href_present(href):
|
|
||||||
for x in self.hrefs:
|
|
||||||
if x.lower() == href.lower():
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
if id is not None:
|
if id is not None:
|
||||||
base = id
|
base = id
|
||||||
index = 1
|
index = 1
|
||||||
@ -1197,7 +1191,8 @@ class Manifest(object):
|
|||||||
href = urlnormalize(href)
|
href = urlnormalize(href)
|
||||||
base, ext = os.path.splitext(href)
|
base, ext = os.path.splitext(href)
|
||||||
index = 1
|
index = 1
|
||||||
while href_present(href):
|
lhrefs = set([x.lower() for x in self.hrefs])
|
||||||
|
while href.lower() in lhrefs:
|
||||||
href = base + str(index) + ext
|
href = base + str(index) + ext
|
||||||
index += 1
|
index += 1
|
||||||
return id, href
|
return id, href
|
||||||
|
Loading…
x
Reference in New Issue
Block a user