From 97c631e696d6f266f01593bdf3cd6acec17fe497 Mon Sep 17 00:00:00 2001 From: harry Date: Sat, 10 May 2025 12:34:53 +0800 Subject: [PATCH] feat: improve file extension parsing using pathlib --- app/utils/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils/utils.py b/app/utils/utils.py index 0672681..7efb521 100644 --- a/app/utils/utils.py +++ b/app/utils/utils.py @@ -1,6 +1,7 @@ import json import locale import os +from pathlib import Path import threading from typing import Any from uuid import uuid4 @@ -226,4 +227,4 @@ def load_locales(i18n_dir): def parse_extension(filename): - return os.path.splitext(filename)[1].strip().lower().replace(".", "") + return Path(filename).suffix.lower().lstrip('.')