mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Correct an ambiguous regexp in DiffusionRequest
Summary: See <https://discourse.phabricator-community.org/t/diffusionrequest-regex-error/2057/>. The intent of `[\d-,]` is "digits, hyphen, and comma" but `[x-y]` means "character range x-y". Specify `[\d,-]` instead to disambiguate the hyphen as "literal hyphen", not a character range marker. Test Plan: I can't reproduce the original error as reported, but browsed around Diffusion for a bit. Reviewers: amckinley, avivey Reviewed By: avivey Differential Revision: https://secure.phabricator.com/D19770
This commit is contained in:
parent
9bea00c159
commit
24a061f844
1 changed files with 1 additions and 1 deletions
|
@ -489,7 +489,7 @@ abstract class DiffusionRequest extends Phobject {
|
||||||
// Consume the back part of the URI, up to the first "$". Use a negative
|
// Consume the back part of the URI, up to the first "$". Use a negative
|
||||||
// lookbehind to prevent matching '$$'. We double the '$' symbol when
|
// lookbehind to prevent matching '$$'. We double the '$' symbol when
|
||||||
// encoding so that files with names like "money/$100" will survive.
|
// encoding so that files with names like "money/$100" will survive.
|
||||||
$pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d-,]+)$@';
|
$pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d,-]+)$@';
|
||||||
if (preg_match($pattern, $blob, $matches)) {
|
if (preg_match($pattern, $blob, $matches)) {
|
||||||
$result['line'] = $matches[1];
|
$result['line'] = $matches[1];
|
||||||
$blob = substr($blob, 0, -(strlen($matches[1]) + 1));
|
$blob = substr($blob, 0, -(strlen($matches[1]) + 1));
|
||||||
|
|
Loading…
Reference in a new issue