From: Daniel Stenberg Date: Sat, 23 Aug 2025 14:37:07 +0000 (+0200) Subject: mdlinkcheck: handle links with a leading slash properly X-Git-Tag: curl-8_16_0~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa4596a97efae86711d20d8587db3a6b0c0a59f6;p=thirdparty%2Fcurl.git mdlinkcheck: handle links with a leading slash properly Ref: #18372 Closes #18382 --- diff --git a/scripts/mdlinkcheck b/scripts/mdlinkcheck index f5b123a24a..925edc5294 100755 --- a/scripts/mdlinkcheck +++ b/scripts/mdlinkcheck @@ -99,8 +99,14 @@ sub storelink { my $dir = $f; $dir =~ s:([^/]*\z)::; - while($link =~ s:^\.\.\/::) { - $dir =~ s:([^/]*)\/\z::; + if($link =~ s/(^\/)//) { + # link starts with a slash, now removed + $dir = ""; + } + else { + while($link =~ s:^\.\.\/::) { + $dir =~ s:([^/]*)\/\z::; + } } $flink{"./$dir$link"} .= "$f:$line ";