instance method
tempfile_extension
Ruby on Rails 8.0.5.2
Since v8.0.5.2 Private — implementation detail, not part of the public APISignature
tempfile_extension()
The extension is there for tools that cannot tell the type from the bytes (316d87e4: ImageMagick needs it for an SVG with no XML declaration), but some tools choose a decoder on it alone: FFmpeg runs a .avs file as an AviSynth script. So the uploaded extension is kept only when it denotes the blob’s media type.
Source
# File activestorage/app/models/active_storage/blob.rb, line 358
def tempfile_extension
extension = filename.extension_with_delimiter
return "" if extension.blank?
type_for_extension = Marcel::MimeType.for(name: filename.to_s)
return "" if type_for_extension == Marcel::MimeType::BINARY || type_for_extension != media_type
extension
end
Defined in activestorage/app/models/active_storage/blob.rb line 358
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Blob