From 664d376c8af03111a5c553e609c898b42c47caed Mon Sep 17 00:00:00 2001 From: viktorking7 <140458814+viktorking7@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:13:15 +0200 Subject: [PATCH] CI: improve date validation regex in buildtable.pl and quote filename variable in link format checker script Co-authored-by: bigbear <155267841+aso20455@users.noreply.github.com> Co-authored-by: Jon Atack --- scripts/buildtable.pl | 3 ++- scripts/link-format-chk.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/buildtable.pl b/scripts/buildtable.pl index bc9e4b5f..ae231970 100755 --- a/scripts/buildtable.pl +++ b/scripts/buildtable.pl @@ -199,7 +199,8 @@ while (++$bipnum <= $topbip) { die "First Comments-URI must be exactly \"$first_comments_uri\" in $fn" unless $val eq $first_comments_uri; } } elsif (exists $DateField{$field}) { - die "Invalid date format in $fn" unless $val =~ /^20\d{2}\-(?:0\d|1[012])\-(?:[012]\d|30|31)$/; + # Enforce date format 20XX-MM-DD, where XX is 00-99, MM is 01-12 and DD is 01-31 + die "Invalid date format in $fn" unless $val =~ /^20\d{2}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12]\d|30|31)$/; } elsif (exists $EmailField{$field}) { $val =~ m/^(\S[^<@>]*\S) \<[^@>]*\@[\w.]+\.\w+\>$/ or die "Malformed $field line in $fn"; } elsif (not exists $MiscField{$field}) { diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh index 08c8ef39..b0d14849 100755 --- a/scripts/link-format-chk.sh +++ b/scripts/link-format-chk.sh @@ -8,7 +8,7 @@ ECODE=0 for fname in *.mediawiki; do - GRES=$(grep -n '](http' $fname) + GRES=$(grep -n '](http' "$fname") if [ "$GRES" != "" ]; then if [ $ECODE -eq 0 ]; then >&2 echo "Github Mediawiki format writes link as [URL text], not as [text](url):"