fiddled around a bit and got DirGHandler to work for both files and directories with spaces in them, and plusses in them (on disk). eg: <a href="/files/usr/portage/packages/All/gtk%2B-2.10.1.tbz2">gtk+-2.10.1.tbz2</a><br/> <a href="/files/root/hey+whatsthis+dir">hey whatsthis dir</a> both end up at the right place now.. ..c. -------------- next part -------------- --- /a/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3/lib/mongrel/handlers.rb 2006-08-07 12:26:22.000000000 -0400 +++ ./handlers.rb 2006-08-07 13:36:14.000000000 -0400 @@ -173,14 +173,10 @@ head[Const::CONTENT_TYPE] = "text/html" out << "<html><head><title>Directory Listing</title></head><body>" Dir.entries(dir).each do |child| - child = HttpRequest.unescape(child) next if child == "." - - if child == ".." - out << "<a href=\"#{base}/#{child}\">Up to parent..</a><br/>" - else - out << "<a href=\"#{base}/#{child}/\">#{child}</a><br/>" - end + out << "<a href=\"#{base}/#{ HttpRequest.escape(child)}\">" + out << (child == ".." ? "Up to parent.." : child) + out << "</a><br/>" end out << "</body></html>" end
On Mon, 2006-08-07 at 18:11 +0000, carmen wrote:> fiddled around a bit and got DirGHandler to work for both files and directories with spaces in them, and plusses in them (on disk). > > eg: > > <a href="/files/usr/portage/packages/All/gtk%2B-2.10.1.tbz2">gtk+-2.10.1.tbz2</a><br/> > <a href="/files/root/hey+whatsthis+dir">hey whatsthis dir</a> > > both end up at the right place now..Cool. I reversed your previous patch and did the update. Keep plugging at this since you''re probably the most advanced DirHandler user out there right now. Also, why the hell are the gentoo folks using directory listings pages? You should look at making a nice rest service for that which makes it easier to collect the package info. Anyway, thanks for the patch, grab the pre-release and try it out. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?