forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rails#50107 from chaadow/fix_proxy_controller_untr…
…acked_variants [ActiveStorage] Fix Non tracked variants not working with `ActiveStorage::Representations::ProxyController`
- Loading branch information
Showing
5 changed files
with
50 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module ActiveStorage::Blob::Servable # :nodoc: | ||
def content_type_for_serving | ||
forcibly_serve_as_binary? ? ActiveStorage.binary_content_type : content_type | ||
end | ||
|
||
def forced_disposition_for_serving | ||
if forcibly_serve_as_binary? || !allowed_inline? | ||
:attachment | ||
end | ||
end | ||
|
||
private | ||
def forcibly_serve_as_binary? | ||
ActiveStorage.content_types_to_serve_as_binary.include?(content_type) | ||
end | ||
|
||
def allowed_inline? | ||
ActiveStorage.content_types_allowed_inline.include?(content_type) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters