Skip to content

Commit 35a7125

Browse files
committed
fix(TagsController): Make renameTag routes unique
fixes #2398 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 2316e2f commit 35a7125

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/Controller/InternalTagsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function deleteTag(string $old_name = ''): JSONResponse {
3737
}
3838

3939
#[NoAdminRequired]
40-
#[FrontpageRoute(verb: 'PUT', url: '/tag/{old_name}')]
41-
#[FrontpageRoute(verb: 'POST', url: '/tag/{old_name}')]
40+
#[FrontpageRoute(verb: 'PUT', url: '/tag/{old_name}', postfix: 'put')]
41+
#[FrontpageRoute(verb: 'POST', url: '/tag/{old_name}', postfix: 'post')]
4242
public function renameTag(string $old_name = '', string $new_name = '', string $name = ''): JSONResponse {
4343
return $this->publicController->renameTag($old_name, $new_name, $name);
4444
}

lib/Controller/TagsController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function deleteTag(string $old_name = ''): JSONResponse {
5656
#[Http\Attribute\NoCSRFRequired]
5757
#[Http\Attribute\PublicPage]
5858
#[Http\Attribute\BruteForceProtection(action: 'renameTag')]
59-
#[Http\Attribute\FrontpageRoute(verb: 'POST', url: '/public/rest/v2/tag')]
60-
#[Http\Attribute\FrontpageRoute(verb: 'POST', url: '/public/rest/v2/tag/{old_name}')]
61-
#[Http\Attribute\FrontpageRoute(verb: 'PUT', url: '/public/rest/v2/tag/{old_name}')]
59+
#[Http\Attribute\FrontpageRoute(verb: 'POST', url: '/public/rest/v2/tag', postfix: 'postbody')]
60+
#[Http\Attribute\FrontpageRoute(verb: 'POST', url: '/public/rest/v2/tag/{old_name}', postfix: 'post')]
61+
#[Http\Attribute\FrontpageRoute(verb: 'PUT', url: '/public/rest/v2/tag/{old_name}', postfix: 'put')]
6262
public function renameTag(string $old_name = '', string $new_name = '', string $name = ''): JSONResponse {
6363
if (!Authorizer::hasPermission(Authorizer::PERM_WRITE, $this->authorizer->getPermissionsForFolder(-1, $this->request))) {
6464
$res = new JSONResponse(['status' => 'error', 'data' => ['Could not find tag']], Http::STATUS_BAD_REQUEST);

0 commit comments

Comments
 (0)