mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Validate new Phurl URL
Summary: Closes T9691, Validate URL on Phurl objects for using valid protocols. Test Plan: Create or edit URL. Change URL to "asdf" and observe error. Change back to "http://google.com" and observe no error. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Maniphest Tasks: T9691 Differential Revision: https://secure.phabricator.com/D14389
This commit is contained in:
parent
f5c1083764
commit
60cf71e724
1 changed files with 15 additions and 0 deletions
|
@ -125,6 +125,21 @@ final class PhabricatorPhurlURLEditor
|
|||
$error->setIsMissingFieldError(true);
|
||||
$errors[] = $error;
|
||||
}
|
||||
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getOldValue() != $xaction->getNewValue()) {
|
||||
$protocols = PhabricatorEnv::getEnvConfig('uri.allowed-protocols');
|
||||
$uri = new PhutilURI($xaction->getNewValue());
|
||||
if (!isset($protocols[$uri->getProtocol()])) {
|
||||
$errors[] = new PhabricatorApplicationTransactionValidationError(
|
||||
$type,
|
||||
pht('Invalid URL'),
|
||||
pht('The protocol of the URL is invalid.'),
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue