Skip to content

fix(datasource): handle CSV extensions case-insensitively - #1457

Merged
XiaJunjie2020 merged 2 commits into
dataease:mainfrom
Kapozux:fix/csv-extension-case
Nov 17, 2026
Merged

XiaJunjie2020 merged 2 commits into
dataease:mainfrom
Kapozux:fix/csv-extension-case

Conversation

@Kapozux

@Kapozux Kapozux commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #1456.

Datasource uploads accept CSV extensions case-insensitively, but the readers and the legacy upload endpoint selected the Excel parser for stored names such as orders.CSV. Use the same case-insensitive CSV check for preview, import, CSV sheet naming and the legacy upload endpoint. Keep the original filename and path so existing stored uploads work too.

Verification

  • Added eight regressions covering identical .csv, .CSV and .CsV files, an Excel workbook named sales.CSV.xlsx, and a multipart request to the legacy upload route. Five failed on the base commit. All eight pass with this change.
  • Exercised /datasource/parseExcel, /datasource/importToDb and /datasource/uploadExcel with FastAPI TestClient, test identity and a disposable PostgreSQL 17.11 database. Each suffix produced the same two preview rows, the import returned Sheet1, and both import paths persisted the expected rows.
  • Ran the CSV, upload path, import path and upload filename test files with the same environment and tests on both revisions. Base 2e81ded5 had 66 passes and 14 failures. This branch has 71 passes and 9 failures. The remaining nine are unchanged upload guard failures: seven expect a top-level filePath and two expect a different rejection detail for orders.xlsx:extra.

@XiaJunjie2020
XiaJunjie2020 merged commit 4f045ba into dataease:main Nov 17, 2026
1 check passed
Kapozux added a commit to Kapozux/SQLBot that referenced this pull request Nov 17, 2026
The merge of main into dataease#1457 kept both the old and the new CSV
condition in read_import_dataframe, leaving an `if` with no body.
apps/datasource/utils/excel.py fails to import with IndentationError.
XiaJunjie2020 pushed a commit that referenced this pull request Nov 17, 2026
The merge of main into #1457 kept both the old and the new CSV
condition in read_import_dataframe, leaving an `if` with no body.
apps/datasource/utils/excel.py fails to import with IndentationError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Datasource preview and import treat uppercase CSV extensions as Excel workbooks

2 participants