How can i get full path to file in ActiveStorage when i use mirror storage settings?
S3 Storage (203.4ms) Uploaded file to key: variants/WptxR3NcEEmEiiinyKk7pNdf/b20b002e6479c04dc24ec29300eae0b6031556b740555f161a7a3951d98cedc4
Disk Storage (0.7ms) Uploaded file to key: variants/WptxR3NcEEmEiiinyKk7pNdf/b20b002e6479c04dc24ec29300eae0b6031556b740555f161a7a3951d98cedc4
My primary storage is S3, but i want get path from Disc Storage.
I found this solution:
item.img.blob.service.mirrors.first.path_for(item.img.blob.key)
or like this:
ActiveStorage::Blob.service.mirrors.first.path_for(item.img.blob.key)
it return full path to img.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.