Skip to content

fix: handle case where data file has extra extension prefixes #167

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

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
6 changes: 5 additions & 1 deletion nominal/core/filetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ def from_path(cls, path: Path | str, default_mimetype: str = "application/octect
for file_type in FileTypes.__dict__.values():
if not isinstance(file_type, cls):
continue
elif not file_type.extension:
continue

if file_type.extension.endswith(ext_str):
# If the file ends with the given file extension, regardless of other suffixes it may have
# preceeding, then return the file type.
if ext_str.endswith(file_type.extension):
return file_type

# Infer mimetype from filepath
Expand Down
Loading