Skip to content

Commit 24a061f

Browse files
author
epriestley
committedNov 2, 2018
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
1 parent 9bea00c commit 24a061f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/applications/diffusion/request/DiffusionRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ public static function parseRequestBlob($blob, $supports_branches) {
489489
// Consume the back part of the URI, up to the first "$". Use a negative
490490
// lookbehind to prevent matching '$$'. We double the '$' symbol when
491491
// encoding so that files with names like "money/$100" will survive.
492-
$pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d-,]+)$@';
492+
$pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d,-]+)$@';
493493
if (preg_match($pattern, $blob, $matches)) {
494494
$result['line'] = $matches[1];
495495
$blob = substr($blob, 0, -(strlen($matches[1]) + 1));

0 commit comments

Comments
 (0)
Failed to load comments.