mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-12 03:05:30 +01:00
Conversion pipeline: When generating filenames use case insensitive checks for pre-existing filenames
This commit is contained in:
parent
346399d1dc
commit
4d899142fd
1 changed files with 7 additions and 1 deletions
|
|
@ -1181,6 +1181,12 @@ def generate(self, id=None, href=None):
|
|||
:param:`href` are `None` then the corresponding item in the return
|
||||
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:
|
||||
base = id
|
||||
index = 1
|
||||
|
|
@ -1191,7 +1197,7 @@ def generate(self, id=None, href=None):
|
|||
href = urlnormalize(href)
|
||||
base, ext = os.path.splitext(href)
|
||||
index = 1
|
||||
while href in self.hrefs:
|
||||
while href_present(href):
|
||||
href = base + str(index) + ext
|
||||
index += 1
|
||||
return id, href
|
||||
|
|
|
|||
Loading…
Reference in a new issue