diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 1 | ||||
-rw-r--r-- | config/initializers/paperclip.rb | 20 | ||||
-rw-r--r-- | config/locales/en.yml | 2 | ||||
-rw-r--r-- | config/webpack/shared.js | 1 |
4 files changed, 22 insertions, 2 deletions
diff --git a/config/application.rb b/config/application.rb index eb5af9cc0..bed935ce3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,7 +27,6 @@ require_relative '../lib/sanitize_ext/sanitize_config' require_relative '../lib/redis/namespace_extensions' require_relative '../lib/paperclip/url_generator_extensions' require_relative '../lib/paperclip/attachment_extensions' -require_relative '../lib/paperclip/storage_extensions' require_relative '../lib/paperclip/lazy_thumbnail' require_relative '../lib/paperclip/gif_transcoder' require_relative '../lib/paperclip/transcoder' diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index e2a045647..26b0a2f7c 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -83,6 +83,26 @@ if ENV['S3_ENABLED'] == 'true' s3_host_alias: ENV['S3_ALIAS_HOST'] || ENV['S3_CLOUDFRONT_HOST'] ) end + + # Some S3-compatible providers might not actually be compatible with some APIs + # used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822 + if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true' + module Paperclip + module Storage + module S3Extensions + def copy_to_local_file(style, local_dest_path) + log("copying #{path(style)} to local file #{local_dest_path}") + s3_object(style).download_file(local_dest_path, { mode: 'single_request' }) + rescue Aws::Errors::ServiceError => e + warn("#{e} - cannot copy #{path(style)} to local file #{local_dest_path}") + false + end + end + end + end + + Paperclip::Storage::S3.prepend(Paperclip::Storage::S3Extensions) + end elsif ENV['SWIFT_ENABLED'] == 'true' require 'fog/openstack' diff --git a/config/locales/en.yml b/config/locales/en.yml index 829cd61d0..4a16098a8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -598,7 +598,7 @@ en: action_taken_by: Action taken by actions: delete_description_html: The reported posts will be deleted and a strike will be recorded to help you escalate on future infractions by the same account. - mark_as_sensitive_description_html: The media in the reported posts will be marked as sensitive and a strike will be recorded to help you escalate on future refractions by the same account. + mark_as_sensitive_description_html: The media in the reported posts will be marked as sensitive and a strike will be recorded to help you escalate on future infractions by the same account. other_description_html: See more options for controlling the account's behaviour and customize communication to the reported account. resolve_description_html: No action will be taken against the reported account, no strike recorded, and the report will be closed. silence_description_html: The profile will be visible only to those who already follow it or manually look it up, severely limiting its reach. Can always be reverted. diff --git a/config/webpack/shared.js b/config/webpack/shared.js index c2a108a89..bbf9f51f1 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -61,6 +61,7 @@ module.exports = { filename: 'js/[name]-[chunkhash].js', chunkFilename: 'js/[name]-[chunkhash].chunk.js', hotUpdateChunkFilename: 'js/[id]-[hash].hot-update.js', + hashFunction: 'sha256', path: output.path, publicPath: output.publicPath, }, |