From 4d899142fdd1f38d5eeb78d806abc33cfd56c0bf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 3 Apr 2010 12:03:17 +0530 Subject: [PATCH] Conversion pipeline: When generating filenames use case insensitive checks for pre-existing filenames --- src/calibre/ebooks/oeb/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 0d8eed4692..a77554062e 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1181,6 +1181,12 @@ class Manifest(object): :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 @@ class Manifest(object): 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