diff --git a/bin/werc.rc b/bin/werc.rc index dccfc60..1b6b7dd 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -61,9 +61,15 @@ fn werc_exec_request { if(~ $local_path */) { if(test -d $local_path) 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. - if not if(ls `{basename -d $local_path}^* >/dev/null >[2]/dev/null) - perm_redirect `{echo $req_path|sed 's,/+$,,'} + if not { + # 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 *'.' *',' *';' *':') perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'}