Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #2407

Merged
merged 4 commits into from
Aug 22, 2024
Merged

Fix CI #2407

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions nucliadb/tests/standalone/integration/test_upload_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from nucliadb.writer.api.v1.router import KB_PREFIX, RESOURCE_PREFIX, RESOURCES_PREFIX
from nucliadb.writer.settings import settings as writer_settings
from nucliadb.writer.tus import TUSUPLOAD, get_storage_manager
from nucliadb_models import content_types


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -366,8 +367,6 @@ async def test_content_type_validation(
],
)
def test_valid_content_types(content_type):
from nucliadb_models import content_types

assert content_types.valid(content_type)


Expand All @@ -378,8 +377,6 @@ def test_valid_content_types(content_type):
],
)
def test_invalid_content_types(content_type):
from nucliadb_models import content_types

assert not content_types.valid(content_type)


Expand Down Expand Up @@ -415,7 +412,7 @@ def test_invalid_content_types(content_type):
("data.xml", "application/xml"),
# Archive files
("archive.zip", "application/zip"),
("archive.rar", "application/x-rar-compressed"),
("fooo.rar", ["application/x-rar-compressed", "application/vnd.rar"]),
("archive.tar", "application/x-tar"),
("archive.tar.gz", "application/x-tar"),
# Invalid content types
Expand All @@ -425,6 +422,7 @@ def test_invalid_content_types(content_type):
],
)
def test_guess_content_type(filename, content_type):
from nucliadb_models import content_types

assert content_types.guess(filename) == content_type
if isinstance(content_type, list):
assert content_types.guess(filename) in content_type
else:
assert content_types.guess(filename) == content_type
4 changes: 4 additions & 0 deletions nucliadb_models/src/nucliadb_models/content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@

EXTRA_VALID_CONTENT_TYPES = {
"application/font-woff",
"application/mp4",
"application/toml",
"application/vnd.jgraph.mxfile",
"application/vnd.ms-excel.sheet.macroenabled.12",
"application/vnd.ms-outlook",
"application/vnd.ms-word.document.macroenabled.12",
"application/vnd.rar",
"application/x-aportisdoc",
"application/x-archive",
Expand All @@ -43,9 +45,11 @@
"application/x-iwork-pages-sffpages",
"application/x-mach-binary",
"application/x-mobipocket-ebook",
"application/x-ms-shortcut",
"application/x-msdownload",
"application/x-ndjson",
"application/x-openscad",
"application/x-sql",
"application/x-zip-compressed",
"application/zstd",
"audio/vnd.dlna.adts",
Expand Down
Loading