History

Fix internal paths with ':' characters not getting clean up properly

Fix #402.

Thibaut Courouble committed 10 years ago

Commit 2813cf91 parent 84566ea3 files · +6 −1Browse files

Unified · Split

3 files
  1. lib/docs/core/filter.rb +4 −0
  2. lib/docs/filters/core/internal_urls.rb +1 −0
  3. lib/docs/filters/core/normalize_paths.rb +1 −1
lib/docs/core/filter.rb+4−0
@@ -85,5 +85,9 @@ module Docs · 84 unmodified lines
8585
8686 URI.decode(result)
8787 end
88+
89+ def clean_path(path)
90+ path.gsub %r{[!;:]+}, '-'
91+ end
8892 end
8993 end
lib/docs/filters/core/internal_urls.rb+1−0
@@ -81,6 +81,7 @@ module Docs · 80 unmodified lines
8181 def internal_path_to(url)
8282 url = index_url if url == root_url
8383 path = effective_url.relative_path_to(url)
84+ path = clean_path(path) if context[:decode_and_clean_paths]
8485 URL.new(path: path, query: url.query, fragment: url.fragment).to_s
8586 end
8687
lib/docs/filters/core/normalize_paths.rb+1−1
@@ -37,7 +37,7 @@ module Docs · 36 unmodified lines
3737
3838 if context[:decode_and_clean_paths]
3939 path = URI.unescape(path)
40− path.gsub! %r{[!;:]+}, '-'
40+ path = clean_path(path)
4141 end
4242
4343 if path == '.'