fix(demos): download link and remove button on ban edit page (#1464)#1469
Merged
Conversation
Closes the first two gaps from #1464: uploaded demos now link to getdemo.php for download, and admins can remove an attached demo via a new bans.remove_demo JSON action with row-level edit permission checks.
Align edit-ban demo lookup with UPPER(demtype), mirror getdemo.php's scandir guard before unlink, fail closed when file deletion fails, and add a forbidden-path API test for admins without edit rights.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
getdemo.phpwhen a demo is attached on the ban edit page (Demo system: no download link, no delete button, slow uploads through reverse proxies and no error feedback on oversized files #1464 issue 1)bans.remove_demoJSON action, with row-level edit-ban permission checks matchingadmin.edit.ban.php(Demo system: no download link, no delete button, slow uploads through reverse proxies and no error feedback on oversized files #1464 issue 2)UPPER(demtype)consistency,getdemo.php-style on-disk validation beforeunlink, and fail-closed when file deletion failsTest plan
./sbpp.sh test --filter='AdminEditBanDemoTest|BansTest::testRemoveDemo'./sbpp.sh testPermissionMatrixTest covers new action registration./sbpp.sh phpstan./sbpp.sh composer api-contract(regeneratedapi-contract.js)Fixes #1464 (issues 1 and 2 only; reverse-proxy upload slowness / external URL linking remain out of scope)