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:
		| @@ -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; | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 lkassianik
					lkassianik