It works well with files with english symbols in name, but if file has cyrillic name, it fails with exception: "undefined method `body' for nil:NilClass"
@file_msg.file.retrieve_from_store!(File.basename(@file_msg.file.url))
@file_msg.file.cache_stored_file!
send_file(@file_msg.file_url,
:disposition => 'attachment',
:url_based_filename => false,
:x_sendfile => true)
How i can retrieve file with non-unicode symbols in name from S3?
你应该尝试force_encode的File.basename
@file_msg.file.retrieve_from_store! File.basename(@file_msg.file.url).force_encoding("UTF-8"))
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.