diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index 2f27d6fa..fcedd7f0 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -407,6 +407,12 @@ module Gollum presence = "present" end link = ::File.join(@wiki.base_path, page ? page.escaped_url_path : CGI.escape(link_name)) + + # //page is invalid + # strip all duplicate forward slashes using helpers.rb clean_url + # //page => /page + # link = one_leading_slash link + %{#{name}} end end diff --git a/test/test_markup.rb b/test/test_markup.rb index 285be397..bcb0c972 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -55,6 +55,22 @@ context "Markup" do # ######################################################################### + test "absolute link to non-existant page" do + @wiki.write_page("linktest", :markdown, "[[/page]]", commit_details) + + # "
" + page = @wiki.page("linktest") + doc = Nokogiri::HTML page.formatted_data + paras = doc / :p + para = paras.first + anchors = para / :a + assert_equal 1, paras.size + assert_equal 1, anchors.size + assert_equal 'internal absent', anchors[0]['class'] + assert_equal '/Page', anchors[0]['href'] + assert_equal 'Page', anchors[0].text + end + test "double page links no space" do @wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)