mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Fixes webhook diff selecting partial match
By disabling multiline mode, $ becomes the end of the string, so we can match either \Rdiff or $, so that the lazy modifier must match the rest of the string if it can't find \Rdiff
This commit is contained in:
@@ -545,7 +545,7 @@ 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)) {
|
||||
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``" . "`";
|
||||
|
||||
Reference in New Issue
Block a user