instance method tempfile_extension

Ruby on Rails edge

Since v8.0.5.2 Private — implementation detail, not part of the public API

Available in: v8.0.5.2 v8.1.4.1 edge

Signature

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 415
    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 415 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Blob

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close