lib/gollum/frontend/helpers.rb in gollum-2.3.3 vs lib/gollum/frontend/helpers.rb in gollum-2.3.4
- old
+ new
@@ -1,5 +1,6 @@
+# ~*~ encoding: utf-8 ~*~
module Precious
module Helpers
# Extract the path string that Gollum::Wiki expects
def extract_path(file_path)
return nil if file_path.nil?
@@ -17,12 +18,13 @@
def sanitize_empty_params(param)
[nil,''].include?(param) ? nil : CGI.unescape(param)
end
# Remove all slashes from the start of string.
+ # Remove all double slashes
def clean_url url
return url if url.nil?
- url.gsub('%2F','/').gsub(/^\/+/,'')
+ url.gsub('%2F','/').gsub(/^\/+/,'').gsub('//','/')
end
def trim_leading_slash url
return url if url.nil?
url.gsub!('%2F','/')