From 16ef85907343d2dc998e116da072850c3c0a1e37 Mon Sep 17 00:00:00 2001 From: Marko Anastasov Date: Tue, 12 Oct 2010 12:03:45 +0200 Subject: [PATCH] Ignore case when matching image paths. Otherwise images with file extensions in caps don't get rendered. --- lib/gollum/markup.rb | 2 +- test/test_markup.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index 1b1505ec..2a78bbbf 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -162,7 +162,7 @@ module Gollum name = parts[0].strip path = if file = find_file(name) ::File.join @wiki.base_path, file.path - elsif name =~ /^https?:\/\/.+(jpg|png|gif|svg|bmp)$/ + elsif name =~ /^https?:\/\/.+(jpg|png|gif|svg|bmp)$/i name end diff --git a/test/test_markup.rb b/test/test_markup.rb index 9fb5f280..4a7b54c3 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -145,6 +145,17 @@ context "Markup" do end end + test "image with extension in caps with http url" do + ['http', 'https'].each do |scheme| + name = "Bilbo Baggins #{scheme}" + @wiki.write_page(name, :markdown, "a [[#{scheme}://example.com/bilbo.JPG]] b", commit_details) + + page = @wiki.page(name) + output = page.formatted_data + assert_equal %{

a b

}, output + end + end + test "image with absolute path" do @wiki = Gollum::Wiki.new(@path, :base_path => '/wiki') index = @wiki.repo.index