From 54cf76b40c52211860645215ea69ffb76f9d986c Mon Sep 17 00:00:00 2001 From: makoto kuwata Date: Tue, 29 Jun 2010 23:14:33 +0900 Subject: [enhance] index.cgi to expand '~user' path --- contrib/index.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/index.cgi b/contrib/index.cgi index cf3080b..7a0a57b 100644 --- a/contrib/index.cgi +++ b/contrib/index.cgi @@ -49,7 +49,9 @@ begin request_uri = ENV['REQUEST_URI'] or raise "ENV['REQUEST_URI'] is not set." ## get filepath basepath = request_uri.split(/\?/, 2).first - filepath = File.join(document_root, basepath) + filepath = basepath =~ /\A\/(~[-.\w]+)/ \ + ? File.join(File.expand_path($1), "public_html", $') \ + : File.join(document_root, basepath) filepath.gsub!(/\.html\z/, '.rhtml') or # expected '*.html' raise HttpError.new('500 Internal Error', 'invalid .htaccess configuration.') File.file?(filepath) or # file not found -- cgit v1.2.1