From ba1925b155152909e1c164817b2e47ca55c91b7c Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 24 Aug 2017 13:38:52 -0700 Subject: [PATCH] Prevent Differential changeset HTML anchors from colliding with comment anchors Summary: Fixes T12970. This is easier than I expected, and appears to occur in only one place. This prevents a change from ever generating with an anchor like `#12345678`, which is ambiguous because it may be a comment anchor. Test Plan: Viewed a revision, saw new `change-xxxyyyzzz` anchors, clicked one, got jumped to the right place. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12970 Differential Revision: https://secure.phabricator.com/D18465 --- src/applications/differential/storage/DifferentialChangeset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index be83c5e73b..9c718a8765 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -170,7 +170,7 @@ final class DifferentialChangeset extends DifferentialDAO } public function getAnchorName() { - return substr(md5($this->getFilename()), 0, 8); + return 'change-'.PhabricatorHash::digestForIndex($this->getFilename()); } public function getAbsoluteRepositoryPath(