From: Tom Hughes Date: Mon, 31 Aug 2009 23:43:15 +0000 (+0000) Subject: Fix file_column plugin to generate absolute URLs without falling over X-Git-Tag: live~6724 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e72ebb7eacb34e27c0659a267d1eec0fc81f262c?ds=sidebyside Fix file_column plugin to generate absolute URLs without falling over in a heap and then use that in the user details view. --- diff --git a/app/views/user/api_details.builder b/app/views/user/api_details.builder index 656218a92..d70c65f04 100644 --- a/app/views/user/api_details.builder +++ b/app/views/user/api_details.builder @@ -12,9 +12,7 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do :zoom => @user.home_zoom end if @user.image - # i'd love to use "url_for_file_column, :absolute=>true", but that doesn't seem - # to work with the file_column plugin version we're using. - xml.tag! "img", :href => ("http://" + SERVER_URL + url_for_file_column(@user, "image")) + xml.tag! "img", :href => (url_for_file_column(@user, "image", :absolute => true)) end if @user.languages xml.tag! "languages" do diff --git a/vendor/plugins/file_column/lib/file_column_helper.rb b/vendor/plugins/file_column/lib/file_column_helper.rb index f4ebe38e7..8c50053a3 100644 --- a/vendor/plugins/file_column/lib/file_column_helper.rb +++ b/vendor/plugins/file_column/lib/file_column_helper.rb @@ -76,7 +76,7 @@ module FileColumnHelper return nil unless relative_path url = "" - url << request.relative_url_root.to_s if absolute + url << request.protocol << request.host_with_port if absolute url << "/" url << object.send("#{method}_options")[:base_url] << "/" url << relative_path