Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[5.x]: Renaming an asset without the file extension fails with “” is not an allowed file extension.

Aperta
#19,950 1 commento 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
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Start at the asset edit flow that saves the Filename field and trace how it validates extensions, especially names with no extension or a dot in the base name. Add or locate tests for renaming Test.pdf to Test-Renamed and Test-Schedule-v1.2; done means the original extension is retained or the validation error clearly reports a missing or disallowed extension.

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

Descrizione

bug repo:cms
What happened?

On the asset edit page, the Filename field contains the full filename, including the extension (e.g. Activities-Schedule.pdf). When editors rename a file, they often type just the new name and leave out the extension, since that's what they'd expect to edit.

Craft then rejects the save, and the error shows an empty extension: “” is not an allowed file extension. The Filename field also goes back to the original name, so it isn't clear to editors what went wrong or how to fix it. Our content editors have reported this as a bug.

The same thing happens when the new name contains a dot, such as a version number (Schedule-v1.2). Craft reads 2 as the extension and rejects it.

It would help if Craft kept the original extension when the new filename has none, or showed the extension as a fixed suffix outside the editable part of the field.

Steps to reproduce

  1. Upload a PDF to any asset volume, e.g. Test.pdf.
  2. Open the asset's edit page in the Control Panel.
  3. In the Filename field, replace the whole value with Test-Renamed (no extension).
  4. Click Save.

Expected behavior

The asset is renamed to Test-Renamed.pdf, keeping the original extension. Or, at minimum, the error says that the file extension is missing.

Actual behavior

The save fails with "Couldn’t save asset." and the field error “” is not an allowed file extension., and the Filename field goes back to Test.pdf.

Renaming to Test-Schedule-v1.2 fails the same way with “2” is not an allowed file extension.

Craft CMS version

5.11.3 (Pro)

PHP version

8.2.30

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions
Lingua principale
PHP
Stelle
3.6k
Fork
706
Merge medio
11h 2m
PR unite (30g)
252

Preparare l'ambiente

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 craftcms/cms

Tutte le issue di craftcms/cms

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.