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 currently use carrierwave 0.11.2 with fog, asset_host, and absolute cache_dir:
CarrierWave.configuredo |config|
ifRails.env.test?config.storage=:fileelseconfig.storage=:fogconfig.fog_directory=Rails.application.secrets.s3_bucketconfig.fog_credentials={provider: 'AWS',aws_access_key_id: Rails.application.secrets.s3_key,aws_secret_access_key: Rails.application.secrets.s3_secret,region: Rails.application.secrets.s3_region,}config.asset_host=Rails.application.secrets.amazon_cloudfront_domainendconfig.cache_dir="#{Rails.root}/tmp/uploads"# To let CarrierWave work on herokuconfig.remove_previously_stored_files_after_update=falseend
Now let's see CarrierWave::Uploader::Url.
Let's imagine I have a model with a simple uploader. When the image gets uploaded the model uploader initializes cached SanitizedFile. So the path to the file is /path/to/project/tmp/uploads/bla/bla/bla/filename.jpg. According to the trimming root path code and the asset host set, the url becomes: https://<domain>/path/to/project/tmp/uploads/bla/bla/bla/filename.jpg. And this is incorrect.
I don't know the correct way to fix this. If we don't want to return url for cached/non-stored file I would raise an exception rather than return the incorrect url.
The text was updated successfully, but these errors were encountered:
jughead
changed the title
Absolute cached_dir breaks url
Absolute cache_dir breaks url
Nov 3, 2016
To serve cached files, they must be placed in publicly accessible directory. But you're using Heroku, so you don't have write access to {Rails.root}/public directory.
This is the case that cache storage feature is trying to solve, see the PR for usage: #1312
(note: this feature is not included in 0.11 releases, please use 1.0.0.rc or the master branch)
I currently use carrierwave 0.11.2 with fog,
asset_host
, and absolutecache_dir
:Now let's see CarrierWave::Uploader::Url.
Let's imagine I have a model with a simple uploader. When the image gets uploaded the model uploader initializes cached
SanitizedFile
. So the path to the file is/path/to/project/tmp/uploads/bla/bla/bla/filename.jpg
. According to the trimmingroot
path code and the asset host set, the url becomes:https://<domain>/path/to/project/tmp/uploads/bla/bla/bla/filename.jpg
. And this is incorrect.I don't know the correct way to fix this. If we don't want to return url for cached/non-stored file I would raise an exception rather than return the incorrect url.
The text was updated successfully, but these errors were encountered: