medusajs/medusa

Admin CSV import rejects valid .csv files on Windows (MIME type check)

Open

#15416 opened on May 17, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)TypeScript (22,539 stars) (2,090 forks)batch import
good first issuetype: bug

Description

Bug Report

Description

The product import CSV upload in the admin dashboard rejects valid .csv files on Windows machines where Microsoft Excel is installed. The error displayed is:

'{filename}.csv' is not a supported file type. Supported file types are: .csv.

Root Cause

The UploadImport component validates files by checking file.type (MIME type) against ["text/csv"]:

// packages/admin/dashboard/src/routes/products/product-import/components/upload-import.tsx
const SUPPORTED_FORMATS = ["text/csv"]

const hasInvalidFiles = (fileList: FileType[]) => {
  const invalidFile = fileList.find(
    (f) => !SUPPORTED_FORMATS.includes(f.file.type)
  )
  // ...
}

On Windows with Excel installed, the registry key HKEY_CLASSES_ROOT\.csv has Content Type set to application/vnd.ms-excel instead of text/csv. The browser reports this system-level MIME type, causing the validation to fail despite the file having a valid .csv extension.

Suggested Fix

Check the file extension instead of the MIME type, since MIME type detection is unreliable across operating systems:

const hasInvalidFiles = (fileList: FileType[]) => {
  const invalidFile = fileList.find(
    (f) => !f.file.name.toLowerCase().endsWith(".csv")
  )
  // ...
}

Alternatively, expand SUPPORTED_FORMATS to include common CSV MIME types:

const SUPPORTED_FORMATS = ["text/csv", "application/vnd.ms-excel", "application/csv", "text/plain"]

Environment

  • Medusa version: 2.15.2
  • OS: Windows 11 with Microsoft Excel installed
  • Browsers affected: All (Chrome, Edge, Firefox) — MIME type comes from the OS registry

Steps to Reproduce

  1. Install Microsoft Excel on a Windows machine (or have it pre-installed)
  2. Open the Medusa admin dashboard
  3. Navigate to Products → Import
  4. Try to upload any valid .csv file
  5. Observe the error: "not a supported file type"

Workaround

Users can fix the Windows registry to reassign the CSV MIME type:

Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.csv" -Name "Content Type" -Value "text/csv"

Then restart the browser.

Contributor guide