]> git.plutz.net Git - shellwiki/commitdiff
fix page creation in the absence of page name
authorPaul Hänsch <paul@plutz.net>
Thu, 20 Jul 2023 09:47:21 +0000 (11:47 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 20 Jul 2023 09:47:21 +0000 (11:47 +0200)
handlers/60_newpage.sh

index f3cbde7fa464a867eda5f1852aebf775dfd3a770..42eed3f44a00d40705e47e0ff54328f52552ee83 100755 (executable)
@@ -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"