From e8b5a261898c678942458311d5779926e7909c31 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 4 May 2020 19:29:30 +0100 Subject: [PATCH] Return original path if not matched --- utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index 1538557a3..31d419ba3 100644 --- a/utils.py +++ b/utils.py @@ -771,12 +771,13 @@ def searchBoxPosts(baseDir: str, nickname: str, domain: str, return res -def getFileCaseInsensitive(filename: str) -> str: +def getFileCaseInsensitive(path: str) -> str: """Returns a case specific filename given a case insensitive version of it """ - directory, filename = os.path.split(filename) + directory, filename = os.path.split(path) directory, filename = (directory or '.'), filename.lower() for f in os.listdir(directory): - newFilename = os.path.join(directory, f) - if os.path.isfile(newFilename) and f.lower() == filename: - return newFilename + newpath = os.path.join(directory, f) + if os.path.isfile(newpath) and f.lower() == filename: + return newpath + return path