You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded my carrierwave version from 1.2.0 to 2.1.0. I am using fog (AWS) for storage and, after following the instructions in this issue, I set cache_storage =:file.
However, I am still seeing unexpected behavior. The image does save locally to the cache under the expected folder, and when I set the image, and call my_model.uploader.cached? it does return the cache_id. Yet when I call my_model.save!, the image is not saved to the AWS store_dir, neither is the cache image removed.
I attempted to use cache_storage: fog, and have the same issue -- the image saves to an S3 cache bucket, but upon save, does not save to the intended directory.
I've been debugging locally and discovered that, when I call my_model.save! and the following method is called in the gem's lib/carrierwave/uploader/store.rb:
def store!(new_file=nil)
cache!(new_file) if new_file && ((@cache_id != parent_cache_id) || @cache_id.nil?)
if !cache_only && @file && @cache_id
with_callbacks(:store, new_file) do
new_file = storage.store!(@file)
if delete_tmp_file_after_storage
@file.delete unless move_to_store
cache_storage.delete_dir!(cache_path(nil))
end
@file = new_file
@cache_id = @identifier = nil
@staged = false
end
end
end
The @cache_id is nil. I'm assuming that has something to do with the fact that it then does not save the image nor delete the cache.
Please advise on how to proceed. I'd be happy to submit a PR for the issue but I need a little bit of guidance on where in the carrierwave code I should look for the issue.
The text was updated successfully, but these errors were encountered:
Hello 👋🏼
I recently upgraded my carrierwave version from 1.2.0 to 2.1.0. I am using
fog
(AWS) forstorage
and, after following the instructions in this issue, I setcache_storage =:file
.However, I am still seeing unexpected behavior. The image does save locally to the cache under the expected folder, and when I set the image, and call
my_model.uploader.cached?
it does return thecache_id
. Yet when I callmy_model.save!
, the image is not saved to the AWSstore_dir
, neither is the cache image removed.I attempted to use
cache_storage: fog
, and have the same issue -- the image saves to an S3 cache bucket, but upon save, does not save to the intended directory.I've been debugging locally and discovered that, when I call
my_model.save!
and the following method is called in the gem'slib/carrierwave/uploader/store.rb
:The
@cache_id
is nil. I'm assuming that has something to do with the fact that it then does not save the image nor delete the cache.Please advise on how to proceed. I'd be happy to submit a PR for the issue but I need a little bit of guidance on where in the carrierwave code I should look for the issue.
The text was updated successfully, but these errors were encountered: