feat: improve file extension parsing using pathlib
This commit is contained in:
@@ -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('.')
|
||||||
|
|||||||
Reference in New Issue
Block a user