Page MenuHomePhabricator

D14379.diff
No OneTemporary

D14379.diff

diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
--- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
+++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php
@@ -96,13 +96,33 @@
$url,
PhabricatorPolicyCapability::CAN_EDIT);
- $actions->addAction(
- id(new PhabricatorActionView())
- ->setName(pht('Edit'))
- ->setIcon('fa-pencil')
- ->setHref($this->getApplicationURI("url/edit/{$id}/"))
- ->setDisabled(!$can_edit)
- ->setWorkflow(!$can_edit));
+ $allowed_protocols = PhabricatorEnv::getEnvConfig('uri.allowed-protocols');
+ $uri = new PhutilURI($url->getLongURL());
+ $url_protocol = $uri->getProtocol();
+
+ $can_access = false;
+ $redirect_uri = $url->getMonogram();
+
+ if (strlen($url_protocol)) {
+ $can_access = in_array($url_protocol, $allowed_protocols);
+ $redirect_uri = $uri;
+ }
+
+ $actions
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Edit'))
+ ->setIcon('fa-pencil')
+ ->setHref($this->getApplicationURI("url/edit/{$id}/"))
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Visit URL'))
+ ->setIcon('fa-external-link')
+ ->setHref($redirect_uri)
+ ->setDisabled(!$can_edit || !$can_access)
+ ->setWorkflow(!$can_edit));
return $actions;
}

File Metadata

Mime Type
text/plain
Expires
Oct 6 2025, 1:21 PM (14 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8781238
Default Alt Text
D14379.diff (1 KB)

Event Timeline