analysis.detection: file type detection is case-sensitive, and the error garbles the extension #13

Open
opened 2026-10-06 13:46:32 +00:00 by ffrauenberger · 0 comments
Owner

Severity: medium (files like EXPORT.CSV are rejected)

Where

  • app/analysis/detection_model.py:56-66

Problem

for file_type, suffixes in self.file_type_mappings.items():
    for suffix in suffixes:
        if file_name.endswith(suffix):        # ".csv" only, case-sensitive
            return file_type
raise UnsupportedFileTypeException(file_name.split(".")[-1][1:])
  • Streamlit's file_uploader(type=[".csv", ".xes"]) accepts EXPORT.CSV or log.Xes because its check is case-insensitive, but detection then fails.
  • split(".")[-1] already removes the dot, so the extra [1:] cuts off the first letter of the extension in the error message.

Steps to reproduce

  1. Open the application
  2. Upload a file named EXPORT.CSV

Expected behavior

The file is recognized as CSV and imported.

Actual behavior

The user is sent back with the error "Unsupported file type 'SV'".

Fix

Compare with file_name.lower().endswith(suffix.lower()) (or use pathlib.Path(name).suffix.lower()), and drop the [1:].


from issues/BUG-013-file-type-detection-is-case-sensitive.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** medium (files like `EXPORT.CSV` are rejected) ## Where - `app/analysis/detection_model.py:56-66` ## Problem ```python for file_type, suffixes in self.file_type_mappings.items(): for suffix in suffixes: if file_name.endswith(suffix): # ".csv" only, case-sensitive return file_type raise UnsupportedFileTypeException(file_name.split(".")[-1][1:]) ``` - Streamlit's `file_uploader(type=[".csv", ".xes"])` accepts `EXPORT.CSV` or `log.Xes` because its check is case-insensitive, but detection then fails. - `split(".")[-1]` already removes the dot, so the extra `[1:]` cuts off the first letter of the extension in the error message. ### Steps to reproduce 1. Open the application 2. Upload a file named `EXPORT.CSV` ### Expected behavior The file is recognized as CSV and imported. ### Actual behavior The user is sent back with the error *"Unsupported file type 'SV'"*. ## Fix Compare with `file_name.lower().endswith(suffix.lower())` (or use `pathlib.Path(name).suffix.lower()`), and drop the `[1:]`. --- from `issues/BUG-013-file-type-detection-is-case-sensitive.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#13
No description provided.