From 64e73e98fb1c7dde4fc84318d101165223398469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 1 Jun 2015 20:08:41 +0200 Subject: [PATCH] FIX: allow the cooked_post_processor to download external uploads --- app/models/upload.rb | 2 +- spec/models/upload_spec.rb | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index 22b47682a8b..6b4f0782b24 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -137,7 +137,7 @@ class Upload < ActiveRecord::Base url = url.sub(/^#{Discourse.asset_host}/i, "") if Discourse.asset_host.present? # 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? - Upload.find_by(url: url) if Discourse.store.has_been_uploaded?(url) + Upload.find_by(url: url) end def self.fix_image_orientation(path) diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb index 95844751404..1e41637fed8 100644 --- a/spec/models/upload_spec.rb +++ b/spec/models/upload_spec.rb @@ -141,11 +141,6 @@ describe Upload do Upload.get_from_url("http://my.cdn.com/uploads/default/1/02395732905.jpg") 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