From 0aff5042e507897c23e0170d1a1201784efb57ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sat, 30 Mar 2013 17:56:25 +0100 Subject: [PATCH] FIX: S3 image upload --- app/models/upload.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index cb88e0d0082..f59d2082efb 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -68,7 +68,6 @@ class Upload < ActiveRecord::Base blob = file.read sha1 = Digest::SHA1.hexdigest(blob) - Fog.credentials_path = "#{Rails.root}/config/fog_credentials.yml" fog = Fog::Storage.new(provider: 'AWS') @@ -83,7 +82,8 @@ class Upload < ActiveRecord::Base public: true, content_type: file.content_type) upload.width, upload.height = ImageSizer.resize(*image_info.size) - upload.url = "#{Rails.configuration.action_controller.asset_host}#{path}/#{remote_filename}" + upload.url = "https://#{SiteSetting.s3_upload_bucket}.s3.amazonaws.com#{path}/#{remote_filename}" + upload.save upload