From: Tom Hughes Date: Wed, 28 Apr 2010 17:48:56 +0000 (+0100) Subject: Fix mangling of wikipedia links X-Git-Tag: live~6323^2~6^2~1 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/90d2ed759fe2289cea3ed0d3d422881e65249275?hp=5f1fc761fbe25184dba00caaf218de23490279dc 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. --- 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