From 55df7bb9c40c232b2eac429c5d9f164f1923240c Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Wed, 22 Aug 2012 17:30:46 -0600 Subject: [PATCH] Use encodeURIComponent instead of CGI::escape when output is sent to browser. --- lib/gollum/frontend/app.rb | 4 ++-- lib/gollum/markup.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index c69cede2..ddbaaa64 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -136,7 +136,7 @@ module Precious mustache :edit end else - redirect to("/create/#{CGI.escape(@name)}") + redirect to("/create/#{encodeURIComponent(@name)}") end end @@ -354,7 +354,7 @@ module Precious file.raw_data else page_path = [path, name].compact.join('/') - redirect to("/create/#{CGI.escape(page_path).gsub('%2F','/')}") + redirect to("/create/#{encodeURIComponent(page_path).gsub('%2F','/')}") end end diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index 9b35f0f8..279991c3 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -87,7 +87,7 @@ module Gollum def process_headers(doc) toc = nil doc.css('h1,h2,h3,h4,h5,h6').each do |h| - id = CGI::escape(h.content.gsub(' ','-')) + id = encodeURIComponent(h.content.gsub(' ','-')) level = h.name.gsub(/[hH]/,'').to_i # Add anchors