Chore: remove unused is_file_ext_supported

Nothing in production called it, only its own test.
This commit is contained in:
Trenton H committed 2026-11-16 07:18:53 -08:00
1 parent 4610171a94
commit 1326378a90
2 files changed
-17

No files matched your search

-11
View File
@@ -44,17 +44,6 @@ def get_default_file_extension(mime_type: str) -> str:
return ext if ext else ""
def is_file_ext_supported(ext: str) -> bool:
"""
Returns True if the file extension is supported, False otherwise
TODO: Investigate why this really exists, why not use mimetype
"""
if ext:
return ext.lower() in get_supported_file_extensions()
else:
return False
def get_supported_file_extensions() -> set[str]:
extensions = set()
for parser_class in get_parser_registry().all_parsers():
-6
View File
@@ -14,7 +14,6 @@ from documents.parsers import encode_thumbnail_webp
from documents.parsers import get_default_file_extension
from documents.parsers import get_default_thumbnail
from documents.parsers import get_supported_file_extensions
from documents.parsers import is_file_ext_supported
from documents.parsers import make_thumbnail_from_pdf
from documents.parsers import rasterize_pdf_page_to_png
from paperless.parsers.registry import get_parser_registry
@@ -132,11 +131,6 @@ class TestParserAvailability:
# Test invalid mimetype returns no extension
assert get_default_file_extension("aasdasd/dgfgf") == ""
def test_file_extension_support(self) -> None:
assert is_file_ext_supported(".pdf")
assert not is_file_ext_supported(".hsdfh")
assert not is_file_ext_supported("")
class TestComputeThumbnailDpi:
@pytest.mark.parametrize(