Merge pull request #4865 from Citadel-Station-13/upstream-merge-34323

[MIRROR] Fixes webhook diff selecting partial match
This commit is contained in:
LetterJay
2018-01-17 09:39:20 -06:00
committed by GitHub
@@ -545,8 +545,8 @@ function auto_update($payload){
get_diff($payload);
$content = file_get_contents('https://raw.githubusercontent.com/' . $repoOwnerAndName . '/' . $tracked_branch . '/'. $path_to_script);
$content_diff = "### Diff not available. :slightly_frowning_face:";
if($github_diff && preg_match('/(diff --git a\/' . preg_quote($path_to_script, '/') . '.+?)(?:^diff)?/sm', $github_diff, $matches)) {
$script_diff = matches[1];
if($github_diff && preg_match('/(diff --git a\/' . preg_quote($path_to_script, '/') . '.+?)(?:\Rdiff|$)/s', $github_diff, $matches)) {
$script_diff = $matches[1];
if($script_diff) {
$content_diff = "``" . "`DIFF\n" . $script_diff ."\n``" . "`";
}