From 14a651b8b65411e8027156015722b8a836daa9d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Sun, 20 Aug 2023 23:35:48 +0200 Subject: [PATCH] bugfix: prevent globbing of :translation pages with --system parameter --- tools.sh | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/tools.sh b/tools.sh index d147b73..4e93d3f 100755 --- a/tools.sh +++ b/tools.sh @@ -106,22 +106,17 @@ page_glob(){ esac \ | sort -u \ | while read -r page; do - case $page in - \#*|*/\#*) # Not a page directory (just a metadata dir) - continue - ;; - \[*\]/*|*/\[*\]/*) # Omit "system" pages unless explicitly wanted - [ "$glob_system_pages" != true ] \ - && continue \ - || pagedir="$(page_abs "$page")" - ;; - \:*|*/\:*) # Omit translation pages if translations are enabled - [ "$LANGUAGE_DEFAULT" ] \ - && continue \ - || pagedir="$(page_abs "$page")" - ;; - *) pagedir="$(page_abs "$page")";; - esac + # Not a page directory (just a metadata dir) + [ ! "${page%%#*}" -o ! "${page%%*/#*}" ] && continue + + # Omit "system" pages unless explicitly wanted + [ ! "${page%%\[*\]/*}" -o ! "${page%%*/\[*\]/*}" ] && [ "$glob_system_pages" != true ] && continue + + # Omit translation pages if translations are enabled + [ ! "${page%%:*}" -o ! "${page%%*/:*}" ] && [ "$LANGUAGE_DEFAULT" ] && continue + + pagedir="$(page_abs "$page")" + if [ -d "$_DATA/pages/$pagedir" -o -d "$_EXEC/pages/$pagedir" ]; then printf '%s\n' "$page" if ! [ "$depth" -eq 0 ]; then -- 2.39.2