From 2ab121573ee779a2ee0d443ebe4c29045bdf5aa6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 16 Feb 2023 07:36:06 +0100 Subject: [PATCH] handles links to GH security issues --- news2markdown.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/news2markdown.php b/news2markdown.php index cc28590..8387b5d 100755 --- a/news2markdown.php +++ b/news2markdown.php @@ -24,8 +24,11 @@ foreach ($text as $line) { if ($debug) echo "+ Ignore $line\n"; continue; } + $github = 'https://github.com/php/php-src'; + $line = preg_replace('/(#[0-9]+)/', 'php\1', $line); - $line = preg_replace('/(GH-([0-9]+))/', '[\1](https://github.com/php/php-src/issues/\2)', $line); + $line = preg_replace('/(GH-([0-9]+))/', "[\\1]($github/issues/\\2)", $line); + $line = preg_replace('/(GHSA-([^ ]+))/', "[\\1]($github/security/advisories/\\1)", $line); $line = preg_replace('/(CVE-[0-9]+-[0-9]+)/', '**\1**', $line); if (empty($line)) { echo "\n\n";