From: Paul Hänsch Date: Thu, 20 Jul 2023 09:47:21 +0000 (+0200) Subject: fix page creation in the absence of page name X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=be92c87c4ce7e1224843d684e41df33c84c77cf5;p=shellwiki fix page creation in the absence of page name --- diff --git a/handlers/60_newpage.sh b/handlers/60_newpage.sh index f3cbde7..42eed3f 100755 --- a/handlers/60_newpage.sh +++ b/handlers/60_newpage.sh @@ -19,8 +19,15 @@ template="$(POST template)" page="$(POST page)" if [ "$page" ]; then + # either a page name has been entered pattern="$(date +"$pattern")" page="$(printf -- "$pattern" "$page")" + +elif [ "${pattern%%"%%s"*}" = "${pattern}" ]; then + # or a page name is not part of the pattern + pattern="$(date +"$pattern")" + page="$pattern" + else printf 'Refresh: %i; url=%s\r\n' 4 ./ export ERROR_MSG="Page name required"