From ca56e8590a3df188af5710cf4ef7b3e9780dd780 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 19 Jun 2019 10:37:53 -0700 Subject: [PATCH] Don't handle JIRA/Asana URIs with anchors or query parameters in a special way (with Doorkeeper) Summary: Ref T13291. See PHI1312. Currently, if you link to a JIRA or Asana issue with an anchor (`#asdf`) or query parameters (`?a=b`), we: - treat the link as an external object reference and attempt a lookup on it; - if the lookup succeeds, we discard the fragment or parameters when re-rendering the rich link (with the issue/task title). Particularly, the re-rendering part uses the canonical URI of the object, and can discard these parameters/fragments, which is broken/bad. As a first pass at improving this, just don't apply special behavior for links with anchors or parameters -- simply treat them as links. In some future change, we could specialize this behavior and permit certain known parameters or anchors or something, but these use cases are likely fairly marginal. Test Plan: Before: {F6516392} After: {F6516393} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13291 Differential Revision: https://secure.phabricator.com/D20592 --- .../auth/provider/PhabricatorAsanaAuthProvider.php | 8 ++++++++ .../auth/provider/PhabricatorJIRAAuthProvider.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php b/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php index 8a0fccec28..4067e522af 100644 --- a/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAsanaAuthProvider.php @@ -59,6 +59,14 @@ final class PhabricatorAsanaAuthProvider return null; } + if (strlen($uri->getFragment())) { + return null; + } + + if ($uri->getQueryParamsAsPairList()) { + return null; + } + $context_id = $matches[1]; $task_id = $matches[2]; diff --git a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php index 23f7e7f706..c26c70ce37 100644 --- a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php @@ -341,6 +341,14 @@ final class PhabricatorJIRAAuthProvider return null; } + if (strlen($uri->getFragment())) { + return null; + } + + if ($uri->getQueryParamsAsPairList()) { + return null; + } + $domain = $matches[1]; $issue = $matches[2];