From fb2b88a4a81f12d8e338e466a08f6d4e0014e83a Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 Apr 2016 10:27:12 -0700 Subject: [PATCH] Fix Phriction link syntax a little more Summary: This still wasn't quite right -- a link like `[[ Porcupine Facts ]]` with a space would not lookup correctly, and would render as `porcupine_facts`. Test Plan: Verified that `[[ Porcupine Facts ]]` now works correctly. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D15780 --- .../phriction/markup/PhrictionRemarkupRule.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php index 79e3788d11..c3a795a524 100644 --- a/src/applications/phriction/markup/PhrictionRemarkupRule.php +++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php @@ -85,6 +85,9 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule { } $slugs = ipull($metadata, 'link'); + foreach ($slugs as $key => $slug) { + $slugs[$key] = PhabricatorSlug::normalize($slug); + } // We have to make two queries here to distinguish between // documents the user can't see, and documents that don't @@ -115,14 +118,14 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule { if (idx($existant_documents, $slug) === null) { // The target document doesn't exist. if ($name === null) { - $name = explode('/', trim($slug, '/')); + $name = explode('/', trim($link, '/')); $name = end($name); } $class = 'phriction-link-missing'; } else if (idx($visible_documents, $slug) === null) { // The document exists, but the user can't see it. if ($name === null) { - $name = explode('/', trim($slug, '/')); + $name = explode('/', trim($link, '/')); $name = end($name); } $class = 'phriction-link-lock';