Skip to content

Instantly share code, notes, and snippets.

@yoshimov
Created February 27, 2014 02:43
Show Gist options
  • Select an option

  • Save yoshimov/9243326 to your computer and use it in GitHub Desktop.

Select an option

Save yoshimov/9243326 to your computer and use it in GitHub Desktop.
*** ./lib/gollum/helpers.rb.org Thu Feb 27 00:19:51 2014
--- ./lib/gollum/helpers.rb Thu Feb 27 00:20:35 2014
***************
*** 6,12 ****
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
! file_path[0, last_slash]
end
end
--- 6,12 ----
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
! URI.unescape(file_path[0, last_slash])
end
end
***************
*** 18,24 ****
# File.basename is too eager to please and will return the last
# component of the path even if it ends with a directory separator.
! ::File.basename(file_path)
end
def sanitize_empty_params(param)
--- 18,24 ----
# File.basename is too eager to please and will return the last
# component of the path even if it ends with a directory separator.
! URI.unescape(::File.basename(file_path))
end
def sanitize_empty_params(param)
*** ./lib/gollum/app.rb.org Thu Feb 27 00:15:22 2014
--- ./lib/gollum/app.rb Thu Feb 27 00:19:45 2014
***************
*** 23,29 ****
# _Header => header which causes errors
def to_url
return nil if self.nil?
! upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'], :force_downcase => false
end
end
--- 23,34 ----
# _Header => header which causes errors
def to_url
return nil if self.nil?
! strip_html_tags.
! convert_accented_html_entities.
! convert_miscellaneous_html_entities.
! collapse.
! replace_whitespace.
! collapse("-")
end
end
***************
*** 297,303 ****
wiki.write_page(name, format, params[:content], commit_message, path)
page_dir = settings.wiki_options[:page_file_dir].to_s
! redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
--- 302,308 ----
wiki.write_page(name, format, params[:content], commit_message, path)
page_dir = settings.wiki_options[:page_file_dir].to_s
! redirect to("/#{clean_url(encodeURIComponent(::File.join(page_dir, path, name)))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
***************
*** 358,364 ****
redirect to("/history/#{@file}")
else
redirect to("/compare/%s/%s...%s" % [
! @file,
@versions.last,
@versions.first]
)
--- 363,369 ----
redirect to("/history/#{@file}")
else
redirect to("/compare/%s/%s...%s" % [
! encodeURIComponent(@file),
@versions.last,
@versions.first]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment