From 887e344c19af9ee6f4855227f8a215a491974794 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Sat, 28 Oct 2023 20:23:42 +0200 Subject: [PATCH] Fix project page 404 after rename and removing new name from alias slugs Summary: When renaming a project to a slug already listed under Additional hashtags and explicitly also removing that to-become slug, accessing the project via the URL `/tag/projectname/` returned a 404 until someone added the current project name explicitly under "Additional hashtags" again. In that case, do not remove the alternative hashtag to avoid the 404. Closes T15636 Test Plan: See steps in https://we.phorge.it/T15636 Reviewers: O1 Blessed Committers, speck Reviewed By: O1 Blessed Committers, speck Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15636 Differential Revision: https://we.phorge.it/D25453 --- .../project/editor/PhabricatorProjectTransactionEditor.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index eb57c39b2c..9c6e5cf4cc 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -295,6 +295,12 @@ final class PhabricatorProjectTransactionEditor } public function removeSlugs(PhabricatorProject $project, array $slugs) { + // Do not allow removing the project's primary slug which the edit form + // may allow through a series of renames/moves. See T15636 + if (($key = array_search($project->getPrimarySlug(), $slugs)) !== false) { + unset($slugs[$key]); + } + if (!$slugs) { return; }