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
85 85
86 URI.decode(result)86 URI.decode(result)
87 end87 end
88
89 def clean_path(path)
90 path.gsub %r{[!;:]+}, '-'
91 end
88 end92 end
89end93end
lib/docs/filters/core/internal_urls.rb+1−0
@@ -81,6 +81,7 @@ module Docs · 80 unmodified lines
81 def internal_path_to(url)81 def internal_path_to(url)
82 url = index_url if url == root_url82 url = index_url if url == root_url
83 path = effective_url.relative_path_to(url)83 path = effective_url.relative_path_to(url)
84 path = clean_path(path) if context[:decode_and_clean_paths]
84 URL.new(path: path, query: url.query, fragment: url.fragment).to_s85 URL.new(path: path, query: url.query, fragment: url.fragment).to_s
85 end86 end
86 87
lib/docs/filters/core/normalize_paths.rb+1−1
@@ -37,7 +37,7 @@ module Docs · 36 unmodified lines
37 37
38 if context[:decode_and_clean_paths]38 if context[:decode_and_clean_paths]
39 path = URI.unescape(path)39 path = URI.unescape(path)
40 path.gsub! %r{[!;:]+}, '-'40 path = clean_path(path)
41 end41 end
42 42
43 if path == '.'43 if path == '.'