From 18c4ae693ac784b1781bbc9e0b57ef71acc4afdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katharina=20Dr=C3=B6ge?= Date: Wed, 8 Apr 2026 22:18:58 +0200 Subject: [PATCH] Handle file tasks case-insensitively --- legendary/downloader/mp/workers.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/legendary/downloader/mp/workers.py b/legendary/downloader/mp/workers.py index 7e5e3e2..3b7e7ba 100644 --- a/legendary/downloader/mp/workers.py +++ b/legendary/downloader/mp/workers.py @@ -12,6 +12,7 @@ from queue import Empty import requests from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK +from legendary.lfs.wine_helpers import case_insensitive_file_search from legendary.models.chunk import Chunk from legendary.models.downloading import ( DownloaderTask, DownloaderTaskResult, @@ -188,11 +189,12 @@ class FileWorker(Process): break # make directories if required - path = os.path.split(j.filename)[0] - if not os.path.exists(os.path.join(self.base_path, path)): - os.makedirs(os.path.join(self.base_path, path)) + path, filename = os.path.split(j.filename) + file_dir = case_insensitive_file_search(os.path.join(self.base_path, path)) + if not os.path.exists(file_dir): + os.makedirs(file_dir) - full_path = os.path.join(self.base_path, j.filename) + full_path = os.path.join(file_dir, filename) if j.flags & TaskFlags.CREATE_EMPTY_FILE: # just create an empty file open(full_path, 'a').close() @@ -231,7 +233,8 @@ class FileWorker(Process): continue try: - os.rename(os.path.join(self.base_path, j.old_file), full_path) + old_path = case_insensitive_file_search(os.path.join(self.base_path, j.old_file)) + os.rename(old_path, full_path) except OSError as e: logger.error(f'Renaming file failed: {e!r}') self.o_q.put(WriterTaskResult(success=False, **j.__dict__))