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

[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null given

Aperta Adatta ai principianti
#20,128 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@i-just ci sta già lavorando.

Dal 28/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Inizia da AssetsController::actionMoveAsset() nel controller degli asset del control panel, nel ramo in cui force è impostato e l'asset in conflitto viene interrogato con ->select(['elements.id']). Segui poi la chiamata a requireVolumePermissionByAsset() fino a requireVolumePermission() per confermare che l'UID del volume è null, quindi estendi la select per includere assets.volumeId e assets.uploaderId. Il lavoro è completo quando: spostare un asset in un volume che contiene già un file con lo stesso nome, scegliendo "Replace it", sposta effettivamente il file, restituisce il toast di successo e non genera più il TypeError volumeUid must be of type string, null given; riproduci il problema con due volumi che contengono lo stesso nome file.

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

Descrizione

bug repo:cms
What happened?
Description

When moving a file from one volume to another in Assets, if a file with the same filename exists in the other volume and you select the "replace it" option the file does not get moved but the toast says it has moved.

(Claude Code's bugfind and fix)

In AssetsController::actionMoveAsset(), when force is set, the conflicting asset is queried with ->select(['elements.id']), so volumeId is never loaded. The following requireVolumePermissionByAsset('deleteAssets', $conflictingAsset) then calls requireVolumePermission() with a null volume UID and throws a TypeError. The control panel still reports success, but nothing is moved.

Fix: also select assets.volumeId (and assets.uploaderId for the peer permission checks).

->select(['elements.id']) to ->select(['elements.id', 'assets.volumeId', 'assets.uploaderId'])

Steps to reproduce
  1. move an asset into a folder (here, a different volume) that already has an asset with the same filename, then choose “Replace it”.
Expected behavior

File is moved

Actual behavior

File is not moved and the following error is thrown: TypeError: volumeUid must be of type string, null given

Craft CMS version

5.11.5.1

PHP version

No response

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
710
Merge medio
12h 19m
PR unite (30g)
293

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.