From c31e6f176a94d4c616b7ecdc96f9114c5ef173e7 Mon Sep 17 00:00:00 2001 From: Uriel Date: Mon, 23 Feb 2009 05:25:08 +0000 Subject: [PATCH] Allow : and , in urls, but strip them and redirect them if they are last char. This fixes some autogenerated links in other sites that will include . and , if they follow an url in an email for example. --- bin/werc.rc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/werc.rc b/bin/werc.rc index 7938100..63d2da2 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -6,7 +6,7 @@ . ./fltr_cache.rc cd .. -forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.]' +forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.,:]' # Expected input: ls -F style, $sitedir/path/to/files/ # @@ -58,8 +58,10 @@ fn werc_exec_request { if not # XXX: This redir might step on apps with synthetic dirs. perm_redirect `{echo $req_path|sed 's,/+$,,'} } + if not if(~ $req_path *'.' *',' *';' *':') + perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'} if not if(test -d $local_path) - perm_redirect $base_url^$req_path^'/' + perm_redirect $req_path^'/' if(! ~ $#args 0) pageTitle=`{ echo $args|sed -e 's/ / - /g' -e 's/_/ /g' }