carrierwave_encrypter_decrypter icon indicating copy to clipboard operation
carrierwave_encrypter_decrypter copied to clipboard

Replace #url call to #path cause we have asset_host config option

Open d4mk0 opened this issue 5 years ago • 1 comments

Story: when I set asset_host option to carrierwave configuration through config/initiaizers/carrierwave.rb

CarrierWave.configure do |config|
  config.asset_host = 'my://awesome.host'
end

My encrypted files feature was broken. Cause now it builds file path by root files storage + unique path by each file. But, #url method should returns remote path, and my correct path to decrypted files was broken with exceptions like this:

****************************No such file or directory @ rb_sysopen - /Users/user/projects/repo/public/Users/user/projects/repo/public/model/field/id/file_name.jpeg

As you can see part /Users/user/projects/repo/public duplicates.

I think that my PR solve this problem.

d4mk0 avatar Feb 26 '19 08:02 d4mk0

I meet the same problem.

Even you are not using asset_host config option the original_file_path is always broken by the duplicated root path string.

ghost avatar May 11 '21 04:05 ghost