mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix two issues with repository monogram regular expressions
Summary: Ref T4245. Fixes T10172. These regular expressions were simply incorrect: they intend `<start> (form one | form two) <end>` but were written as `(<start> form one) | (form two <end>)` which allowed stuff like "R2/R13" to be interpreted as a monogram because it matches `(<start> form one)`. Test Plan: Parsed commit `ba46ffa6169c` from RTEMS repository, see T10172. Before patch, got an identical trace; after patch, clean import. Reviewers: chad, avivey Reviewed By: avivey Maniphest Tasks: T4245, T10172 Differential Revision: https://secure.phabricator.com/D15049
This commit is contained in:
parent
cadd3f1056
commit
155cb1d2c5
2 changed files with 2 additions and 2 deletions
|
@ -48,7 +48,7 @@ final class PhabricatorRepositoryRepositoryPHIDType
|
|||
}
|
||||
|
||||
public function canLoadNamedObject($name) {
|
||||
return preg_match('/^r[A-Z]+|R[1-9]\d*\z/', $name);
|
||||
return preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $name);
|
||||
}
|
||||
|
||||
public function loadNamedObjects(
|
||||
|
|
|
@ -65,7 +65,7 @@ final class PhabricatorRepositoryQuery
|
|||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/^(r[A-Z]+)|(R[1-9]\d*)\z/', $identifier)) {
|
||||
if (preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $identifier)) {
|
||||
$monograms[$identifier] = $identifier;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue