feat: improve file extension parsing using pathlib

This commit is contained in:
harry
2025-05-10 12:34:53 +08:00
parent a601705bf4
commit 97c631e696

View File

@@ -1,6 +1,7 @@
import json import json
import locale import locale
import os import os
from pathlib import Path
import threading import threading
from typing import Any from typing import Any
from uuid import uuid4 from uuid import uuid4
@@ -226,4 +227,4 @@ def load_locales(i18n_dir):
def parse_extension(filename): def parse_extension(filename):
return os.path.splitext(filename)[1].strip().lower().replace(".", "") return Path(filename).suffix.lower().lstrip('.')