[WYSIWYG] ページ権限ユーザーがファイルアップロードに失敗する問題を修正しました#2399
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
WYSIWYG のファイルアップロードで、ベース権限がゲストでもページ権限により編集可能なユーザーがアップロードに失敗する不具合を修正しました。
変更内容
app/Http/Middleware/ConnectPage.phpで、ページ解決処理を整理しました。page_idを最優先し、post_uploadのときだけ POST ボディのpage_idを fallback として利用するようにしました。/uploadと/upload/faceでページ文脈が復元されることを確認する Feature テストを追加しました。page_idを見ないことと、route のpage_idが body より優先されることをテストで確認しました。背景と目的
Issue #2397 で、Connect-CMS v1.41.1 適用後に、ページ権限で編集可能なユーザーが WYSIWYG からファイルアップロードできなくなる事象が報告されました。
原因は、
ConnectPageのページ取得元がルートパラメータ優先へ変わった一方で、WYSIWYG のアップロード処理は/uploadと/upload/faceに POST しており、ルートにpage_idを持たないことでした。その結果、ページ権限判定に必要なページ文脈を復元できず、従来は成功していたアップロードが{"location":"error"}で失敗していました。今回の修正では、upload 系ルートに限って body の
page_idを補完に使うことで、従来の権限判定を復旧することを目的としています。特記事項
page_idの送信仕様は変更していません。post_uploadに限定しており、upload 以外の POST には広げていません。Uploads.page_idの保存処理は従来どおり request body の値を利用しています。レビュー完了希望日
不具合対応のため、2026年4月10日までに確認いただけると助かります。
関連Pull requests/Issues
Fixes #2397
参考
docker compose exec -T webapp php vendor/bin/phpunit tests/Feature/Core/ConnectPageUploadFallbackTest.phpOK (4 tests, 18 assertions)DB変更の有無
無し
チェックリスト