From 88388b744d2303fb9f6eda7b2064acb477ce3eba Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Thu, 20 Jun 2024 17:50:29 +0200 Subject: [PATCH] Serve text files inline Text-only pastes are preferably viewed in the browser instead of downloaded when using their "raw" links. To have browsers render such raw files natively instead of saving them (which, depending on the browser and user defined browser preferences, either comes in the form of a download to a pre-defined directory or of a "Save as" dialogue), have the Content-Disposition header option get set to "inline" instead of "attachment" for text/plain content. Signed-off-by: Georg Pfuetzenreuter --- config/initializers/active_storage.rb | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 config/initializers/active_storage.rb diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb new file mode 100644 index 0000000..60aa23c --- /dev/null +++ b/config/initializers/active_storage.rb @@ -0,0 +1,4 @@ +Rails.application.config.active_storage.content_types_allowed_inline += + %w( + text/plain + )