mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: allow the cooked_post_processor to download external uploads
This commit is contained in:
parent
f736b6face
commit
64e73e98fb
2 changed files with 1 additions and 6 deletions
|
@ -137,7 +137,7 @@ class Upload < ActiveRecord::Base
|
||||||
url = url.sub(/^#{Discourse.asset_host}/i, "") if Discourse.asset_host.present?
|
url = url.sub(/^#{Discourse.asset_host}/i, "") if Discourse.asset_host.present?
|
||||||
# when using s3, we need to replace with the absolute base url
|
# when using s3, we need to replace with the absolute base url
|
||||||
url = url.sub(/^#{SiteSetting.s3_cdn_url}/i, Discourse.store.absolute_base_url) if SiteSetting.s3_cdn_url.present?
|
url = url.sub(/^#{SiteSetting.s3_cdn_url}/i, Discourse.store.absolute_base_url) if SiteSetting.s3_cdn_url.present?
|
||||||
Upload.find_by(url: url) if Discourse.store.has_been_uploaded?(url)
|
Upload.find_by(url: url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fix_image_orientation(path)
|
def self.fix_image_orientation(path)
|
||||||
|
|
|
@ -141,11 +141,6 @@ describe Upload do
|
||||||
Upload.get_from_url("http://my.cdn.com/uploads/default/1/02395732905.jpg")
|
Upload.get_from_url("http://my.cdn.com/uploads/default/1/02395732905.jpg")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works only when the file has been uploaded" do
|
|
||||||
Upload.expects(:find_by).never
|
|
||||||
Upload.get_from_url("http://domain.com/my/file.txt")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue