Be a bit more careful before we redirect to plain files when we get a trailing / and can't find a dir.
This commit is contained in:
parent
771935dd43
commit
6d3bcc867c
1 changed files with 8 additions and 2 deletions
10
bin/werc.rc
10
bin/werc.rc
|
|
@ -61,9 +61,15 @@ fn werc_exec_request {
|
||||||
if(~ $local_path */) {
|
if(~ $local_path */) {
|
||||||
if(test -d $local_path)
|
if(test -d $local_path)
|
||||||
local_path=$local_path^'index'
|
local_path=$local_path^'index'
|
||||||
|
|
||||||
|
# If path has a trailing /, and a plain file exists matching that 'name.*'
|
||||||
|
# remove the traling / and redirect to 'name' .
|
||||||
# XXX: This redir might step on apps with synthetic dirs.
|
# XXX: This redir might step on apps with synthetic dirs.
|
||||||
if not if(ls `{basename -d $local_path}^* >/dev/null >[2]/dev/null)
|
if not {
|
||||||
perm_redirect `{echo $req_path|sed 's,/+$,,'}
|
# TODO: Maybe we should be smarter about how to check for existing files
|
||||||
|
if(ls `{basename -d $local_path}^'.*' >/dev/null >[2]/dev/null)
|
||||||
|
perm_redirect `{echo $req_path|sed 's,/+$,,'}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if not if(~ $req_path *'.' *',' *';' *':')
|
if not if(~ $req_path *'.' *',' *';' *':')
|
||||||
perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'}
|
perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue