@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Validate icon existence when setting project icon

Summary:
Do not allow setting an invalid project icon via the `project.edit` Conduit API but validate the value.

Same game as in D26430.

Closes T16322

Test Plan:
* Run `echo '{"transactions":[{"type":"name","value":"projectWithInvalidIcon"},{"type":"icon", "value":"noexxxist"}]}' | /var/www/html/phorge/arcanist/bin/arc call-conduit --conduit-uri http://phorge.localhost --conduit-token "cli-xxx" project.edit --`
* Succeed before applying this patch
* Fail after applying this patch:
```
{
"error": "ERR-CONDUIT-CORE",
"errorMessage": "ERR-CONDUIT-CORE: <project.edit> Validation errors:\n - Value for \"project:icon\" is invalid: \"noexxxist\".",
"response": null
}
```

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16322

Differential Revision: https://we.phorge.it/D26459

+24
+24
src/applications/project/xaction/PhabricatorProjectIconTransaction.php
··· 39 39 return PhabricatorProjectIconSet::getIconIcon($new); 40 40 } 41 41 42 + public function validateTransactions($object, array $xactions) { 43 + $errors = array(); 44 + 45 + if (!$xactions) { 46 + return $errors; 47 + } 48 + 49 + foreach ($xactions as $xaction) { 50 + $new_icon = $xaction->getNewValue(); 51 + if (!PhabricatorProjectIconSet::getIconName($new_icon)) { 52 + $errors[] = new PhabricatorApplicationTransactionValidationError( 53 + self::TRANSACTIONTYPE, 54 + pht('Invalid'), 55 + pht( 56 + 'Value for "%s" is invalid: "%s".', 57 + self::TRANSACTIONTYPE, 58 + $new_icon)); 59 + break; 60 + } 61 + } 62 + 63 + return $errors; 64 + } 65 + 42 66 }