From ed7b2159fef1c4c926109ab3f2181dcc484d280b Mon Sep 17 00:00:00 2001 From: kevivmatrix Date: Sun, 16 Jun 2019 16:06:12 +0530 Subject: [PATCH 1/2] backblaze private bucket support added --- lib/carrierwave/storage/fog.rb | 2 +- lib/carrierwave/uploader/cache.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/carrierwave/storage/fog.rb b/lib/carrierwave/storage/fog.rb index 582b870f1..9826d962b 100644 --- a/lib/carrierwave/storage/fog.rb +++ b/lib/carrierwave/storage/fog.rb @@ -186,7 +186,7 @@ def attributes # [NilClass] no authenticated url available # def authenticated_url(options = {}) - if ['AWS', 'Google', 'Rackspace', 'OpenStack', 'AzureRM', 'Aliyun'].include?(@uploader.fog_credentials[:provider]) + if ['AWS', 'Google', 'Rackspace', 'OpenStack', 'AzureRM', 'Aliyun', 'backblaze'].include?(@uploader.fog_credentials[:provider]) # avoid a get by using local references local_directory = connection.directories.new(:key => @uploader.fog_directory) local_file = local_directory.files.new(:key => path) diff --git a/lib/carrierwave/uploader/cache.rb b/lib/carrierwave/uploader/cache.rb index f35da282f..87fc0d2f1 100644 --- a/lib/carrierwave/uploader/cache.rb +++ b/lib/carrierwave/uploader/cache.rb @@ -81,6 +81,7 @@ def cache_stored_file! def sanitized_file _content = file.read + return if _content.nil? if _content.is_a?(File) # could be if storage is Fog sanitized = CarrierWave::Storage::Fog.new(self).retrieve!(File.basename(_content.path)) else From 3dfaceaa6b98b35c190ec94b7dd2a8ae27e3afb1 Mon Sep 17 00:00:00 2001 From: kevivmatrix Date: Wed, 25 Dec 2019 23:15:42 +0530 Subject: [PATCH 2/2] backblaze authenticated_url spec added --- spec/storage/fog_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/storage/fog_helper.rb b/spec/storage/fog_helper.rb index 3b271fd26..3a3622aa7 100644 --- a/spec/storage/fog_helper.rb +++ b/spec/storage/fog_helper.rb @@ -483,7 +483,7 @@ def check_file end it "should have an authenticated_url" do - if ['AWS', 'Rackspace', 'Google', 'OpenStack', 'AzureRM', 'Aliyun'].include?(@provider) + if ['AWS', 'Rackspace', 'Google', 'OpenStack', 'AzureRM', 'Aliyun', 'backblaze'].include?(@provider) expect(@fog_file.authenticated_url).not_to be_nil end end