mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: S3 image upload
This commit is contained in:
parent
853c13f705
commit
0aff5042e5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user