From 2b5bb642c0751ad22469efa5c04af3b086c530e9 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 9 Nov 2015 14:33:36 -0800 Subject: [PATCH] Provide a more informative alternative to 404 on invalid shortened Phurl URL Summary: When accessing an invalid URL on the short Phurl domain, users should see informative message Test Plan: Open URL in the previously configured Phurl short domain such as `https://www.zz.us` and see dialog with message. Open `https://www.zz.us/u/123` for a valid `U123` Phurl and access destination URL. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14450 --- .../PhabricatorPhurlShortURLDefaultController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/applications/phurl/controller/PhabricatorPhurlShortURLDefaultController.php b/src/applications/phurl/controller/PhabricatorPhurlShortURLDefaultController.php index 7d48f56e24..8934d4b628 100644 --- a/src/applications/phurl/controller/PhabricatorPhurlShortURLDefaultController.php +++ b/src/applications/phurl/controller/PhabricatorPhurlShortURLDefaultController.php @@ -8,6 +8,16 @@ final class PhabricatorPhurlShortURLDefaultController } public function handleRequest(AphrontRequest $request) { - return new Aphront404Response(); + $dialog = $this->newDialog() + ->setTitle(pht('Invalid URL')) + ->appendParagraph( + pht('This domain can only be used to open URLs'. + ' shortened using the Phurl application. The'. + ' URL you are trying to access does not have'. + ' a Phurl URL associated with it.')); + + return id(new AphrontDialogResponse()) + ->setDialog($dialog) + ->setHTTPResponseCode(404); } }