Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#20,128 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@i-just がすでに取り組んでいます。

2026年10月28日 から。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
backend

調査の方向性

control panel のアセットコントローラーにある AssetsController::actionMoveAsset() から始めてください。force が設定され、競合するアセットを ->select(['elements.id']) で取得している分岐です。続いて requireVolumePermissionByAsset() の呼び出しを requireVolumePermission() まで追い、ボリューム UID が null であることを確認してください。その後、select に assets.volumeId と assets.uploaderId を追加します。完了の条件は、同じファイル名のファイルが既に存在するボリュームへアセットを移動する際に "Replace it" を選ぶと、実際にファイルが移動し、成功のトーストが表示され、volumeUid must be of type string, null given という TypeError が発生しなくなることです。同じファイル名を持つ 2 つのボリュームで再現してください。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
PHP
スター
3.6k
フォーク
710
平均マージ
12時間 19分
マージ済み PR(30日)
293

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

craftcms/cms のほかの issue

craftcms/cms の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。