Fix file_column plugin to generate absolute URLs without falling over
authorTom Hughes <tom@compton.nu>
Mon, 31 Aug 2009 23:43:15 +0000 (23:43 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 31 Aug 2009 23:43:15 +0000 (23:43 +0000)
in a heap and then use that in the user details view.

app/views/user/api_details.builder
vendor/plugins/file_column/lib/file_column_helper.rb

index 656218a92bb8b2d5ede864aa50c118b495e157cb..d70c65f042b924f9fdd1824961d11cc870c0bb98 100644 (file)
@@ -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
index f4ebe38e7e9a3ea64c5a8a346559a551c92b1a1e..8c50053a3bf77dcde47183ae4ec99a05df30b2c1 100644 (file)
@@ -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