[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null given
メンテナーはふだん 1 日以内に返信
@i-just がすでに取り組んでいます。
2026年10月28日 から。
評価
調査の方向性
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 の本文から書いたものです。
説明
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
- 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
craftcms/cms のほかの issue
-
bug repo:cms
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
craftcms/cms#20151 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
craftcms/cms#20150 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
craftcms/cms#20143 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[6.x]: Element index shows thumbnails at the default size until the page finishes loading対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug repo:cms
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
craftcms/cms#20142 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
craftcms/cms#20141 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
wp-graphql/wp-graphql-woocommerce#1026 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
taskforcesh/bullmq#5038 ·
メンテナーはふだん 1 日以内に返信
-
ServiceMapMissingAnalyser reads @method in docblock prose as a tag and reports a phantom accessorオープンagent-ready area:static-analysis bug p3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
gacela-project/gacela#1050 ·
メンテナーはふだん 1 日以内に返信