changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > werc / changeset: Be a bit more careful before we redirect to plain files when we get a trailing / and can't find a dir.

changeset 656: 50a9b770bb43
parent 655: d825e5ea9195
child 657: fb460a671d19
author: Uriel <u@berlinblue.org>
date: Sun, 19 Aug 2012 01:16:10 +0200
files: bin/werc.rc
description: Be a bit more careful before we redirect to plain files when we get a trailing / and can't find a dir.
     1.1--- a/bin/werc.rc	Sun Aug 19 01:07:54 2012 +0200
     1.2+++ b/bin/werc.rc	Sun Aug 19 01:16:10 2012 +0200
     1.3@@ -61,9 +61,15 @@
     1.4     if(~ $local_path */) {
     1.5         if(test -d $local_path)
     1.6             local_path=$local_path^'index'
     1.7+
     1.8+	# If path has a trailing /, and a plain file exists matching that 'name.*'
     1.9+	# remove the traling / and redirect to 'name' .
    1.10         # XXX: This redir might step on apps with synthetic dirs.
    1.11-        if not if(ls `{basename -d $local_path}^* >/dev/null >[2]/dev/null)
    1.12-            perm_redirect `{echo $req_path|sed 's,/+$,,'}
    1.13+        if not {
    1.14+		# TODO: Maybe we should be smarter about how to check for existing files
    1.15+		if(ls `{basename -d $local_path}^'.*' >/dev/null >[2]/dev/null)
    1.16+		    perm_redirect `{echo $req_path|sed 's,/+$,,'}
    1.17+	}
    1.18     }
    1.19     if not if(~ $req_path *'.' *',' *';' *':')
    1.20         perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'}