KML uploads to Documents fail since Payload 3.90.2: empty browser MIME type is rejected for client uploads

Aperta
#1,409 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, typescript
Ambito
backend, cloud

Direzione di ricerca

Start with uploadRequiresServerValidation in payload/dist/uploads/getFileTypeIdentity.js, where an empty MIME type must route the file through the Payload server. Then read assertClientUploadAllowed in the Blob plugin and the earlier patch commit 1057f3cf1 to follow the existing patch convention. Done means a .kml or .gpx uploads to Documents on a preview deploy, typed files still use client uploads, and a regression test covers the empty-MIME case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug payload-workaround ready-for-agent

Problem

Uploading a .kml to Documents from the admin panel fails with a "Failed to initialize Vercel Blob client upload" toast. This started with #1365 (Bump the payloadcms group to 3.90.2), merged 2026-10-07. The last KMLs in production were uploaded before that.

Cause

  1. Chrome on macOS reports File.type as "" for .kml (no registered MIME type). .gpx is likely the same.
  2. The admin's Form only sends an upload through the Payload server when uploadRequiresServerValidation (from payload/shared) returns true. That checks for an .xml/.svg extension or an XML/SVG MIME type, and an empty type matches neither, so the admin takes the Vercel Blob client-upload path.
  3. The Blob plugin's issue-client-upload request calls assertClientUploadAllowed, which since 3.90.2 rejects an empty MIME type with a 400 ("A valid MIME type is required for client uploads.").
  4. VercelBlobClientUploadHandler turns any non-OK response into the generic toast.

clientUploads is plugin-wide, so it can't be turned off for Documents alone, and turning it off would cap every upload at Vercel's 4.5 MB request body limit.

Plan

  1. Patch Payload with pnpm patch: make uploadRequiresServerValidation in payload/dist/uploads/getFileTypeIdentity.js also return true when mimeType is empty, so those files go through the Payload server, which detects the type from the bytes. KML and GPX files are small, so the 4.5 MB limit doesn't matter. Add a regression test that says to delete the patch once upstream fixes it, as the earlier patches did (see 1057f3cf1).
  2. Open an upstream issue on payloadcms/payload with the repro: a file with no browser MIME type fails client upload with a generic error instead of falling back to a server upload. Link it here.
  3. Remove the patch when the upstream fix ships.

Acceptance

  • Uploading a .kml (and .gpx) to Documents from the admin succeeds on a preview deploy with a Blob token.
  • .pdf, .docx and other typed files still use client uploads.
Lingua principale
TypeScript
Stelle
6
Fork
2
Merge medio
1g 11h
PR unite (30g)
35

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NWACus/web

Tutte le issue di NWACus/web

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.