]> git.plutz.net Git - shellwiki/blob - handlers/90_brackets.sh
avoid mishandling of pages (wrong 404 in particular)
[shellwiki] / handlers / 90_brackets.sh
1 #!/bin/sh
2
3 # special case for odd pages that are not handled otherwise
4 # usually those pages look like handlers (i.e. containing brackets)
5 # but are not
6 # attachment and edit (and really all) handlers should take precedence
7
8 case "${PATH_INFO}" in
9   */)
10     if [ ! "$(mdfile "${PATH_INFO}")" ]; then
11       theme_error 404
12     elif ! acl_read "${PATH_INFO}"; then
13       theme_error 403
14     else
15       theme_page "${PATH_INFO}"
16     fi
17     return 0
18     ;;
19   *)
20     if [ -d "$_DATA/pages${PATH_INFO}/" -o -d "$_EXEC/pages${PATH_INFO}/" ]; then
21       REDIRECT "${_BASE}${PATH_INFO}/"
22     fi
23     ;;
24 esac
25
26 return 1