From: Christian Heller Date: Fri, 29 Nov 2024 06:29:49 +0000 (+0100) Subject: From /files path filtering, remove case sensitivity. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/do_todos?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=ytplom From /files path filtering, remove case sensitivity. --- diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index 45d2c40..f875e40 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -393,6 +393,7 @@ class VideoFile(DbData): @property def size(self) -> float: + """If file at .full_path, return its megabytes size, else -1.""" if not self.full_path.is_file(): return -1 return self.full_path.stat().st_size / (1024 * 1024) @@ -991,7 +992,8 @@ class TaskHandler(BaseHTTPRequestHandler): def _send_files_index(self, filter_: ParamsStr, show_absent: bool) -> None: conn = DbConnection() files = [f for f in VideoFile.get_all(conn) - if filter_ in str(f.rel_path) and (show_absent or f.present)] + if filter_.lower() in str(f.rel_path).lower() + and (show_absent or f.present)] conn.commit_close() files.sort(key=lambda t: t.rel_path) self._send_rendered_template(