1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Fix an issue where editing paths in Owners packages could raise an error: undefined index "display"

Summary:
Fixes T13464. Fully-realized paths have a "path" (normalized, effective path) and a "display" path (user-facing, un-normalized path).

During transaction validation we build ref keys for paths before we normalize the "display" values. A few different approaches could be taken to resolve this, but just default the "display" path to the raw "path" if it isn't present since that seems simplest.

Test Plan: Edited paths in an Owners package, no longer saw a warning in the logs.

Maniphest Tasks: T13464

Differential Revision: https://secure.phabricator.com/D20923
This commit is contained in:
epriestley 2019-11-21 11:22:45 -08:00
parent 374f8b10b3
commit 2abf292821

View file

@ -91,11 +91,22 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO {
}
private static function getScalarKeyForRef(array $ref) {
// See T13464. When building refs from raw transactions, the path has
// not been normalized yet and doesn't have a separate "display" path.
// If the "display" path isn't populated, just use the actual path to
// build the ref key.
if (isset($ref['display'])) {
$display = $ref['display'];
} else {
$display = $ref['path'];
}
return sprintf(
'repository=%s path=%s display=%s excluded=%d',
$ref['repositoryPHID'],
$ref['path'],
$ref['display'],
$display,
$ref['excluded']);
}