From 90d2ed759fe2289cea3ed0d3d422881e65249275 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 28 Apr 2010 18:48:56 +0100 Subject: [PATCH 1/1] Fix mangling of wikipedia links Bail out straight away if the tag value is a URL rather than waiting until we have parsed the key as we may change the value in the process of parsing the key. --- app/helpers/browse_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index d2c2b5807..ff702aed1 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -49,6 +49,9 @@ private end def wikipedia_link(key, value) + # Some k/v's are wikipedia=http://en.wikipedia.org/wiki/Full%20URL + return nil if value =~ /^http:\/\// + if key == "wikipedia" # This regex should match Wikipedia language codes, everything # from de to zh-classical @@ -68,9 +71,6 @@ private return nil end - # Some k/v's are wikipedia=http://en.wikipedia.org/wiki/Full%20URL - return nil if value =~ /^http:\/\// - return { :url => "http://#{lang}.wikipedia.org/wiki/#{value}?uselang=#{I18n.locale}", :title => value -- 2.43.2