shithub: werc

Download patch

ref: 566ee0dde940bb97551679209230186722d663c2
parent: 9075bcd0b4092637cb59b2928edfbe35344c5611
author: sl <uriel@engel.se.cat-v.org>
date: Mon Feb 23 00:25:08 EST 2009

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.

--- 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/
 #          <ls -F+x><symlink hack><Useless?><hiden files  >
@@ -58,8 +58,10 @@
         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' }