From ca5fdf6ea9c67a47fcdf4f19ea34be789dae1157 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Mon, 16 Apr 2012 13:50:08 +0100 Subject: [PATCH] Parse archive-contents file more rigorously when building the html index (fixes #49) --- html/index.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html/index.erb b/html/index.erb index bcbcff91..8b8d36e3 100644 --- a/html/index.erb +++ b/html/index.erb @@ -17,7 +17,7 @@ <% def parse str # credit to: http://stackoverflow.com/q/3128406/154508 - tokens = str.scan(/#{Regexp.escape("(")}|#{Regexp.escape(")")}|[a-zA-Z0-9\'\-\_\+]+/) + tokens = str.scan(/#{Regexp.escape("(")}|#{Regexp.escape(")")}|"(?:\\.|[^"])+"|[a-zA-Z0-9\'\-\_\+]+/) stack = [[]] @@ -27,6 +27,8 @@ stack << [] when ")" stack[-2] << stack.pop + when /^"(.*)\"$/ + stack[-1] << $1 else stack[-1] << tok end