From 7ddec6e7c3a8bdfcc69d28a723caca61cdb2a17c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 7 Jan 2017 15:43:56 +0100 Subject: Add read timeout to paperclip when it's downloading remote images --- config/initializers/paperclip.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config/initializers/paperclip.rb') diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index cb7ed4487..4d6154562 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +Paperclip::Attachment.default_options[:read_timeout] = 60 + if ENV['S3_ENABLED'] == 'true' Aws.eager_autoload!(services: %w(S3)) -- cgit From 2e71bb031b2dff90a2b0f9854bdcd804c069268a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 8 Jan 2017 19:12:54 +0100 Subject: Fix Paperclip timeout setting. Fix bug introduced in #437 --- app/models/account.rb | 6 ++++-- config/initializers/paperclip.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'config/initializers/paperclip.rb') diff --git a/app/models/account.rb b/app/models/account.rb index 3a7763a64..ba24cf153 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -190,8 +190,10 @@ class Account < ApplicationRecord follow_mapping(FollowRequest.where(target_account_id: target_account_ids, account_id: account_id), :target_account_id) end - private def follow_mapping(query, field) - query.pluck(field).inject({}) { |mapping, id| mapping[id] = true } + private + + def follow_mapping(query, field) + query.pluck(field).inject({}) { |mapping, id| mapping[id] = true; mapping } end end diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 4d6154562..999ff47c7 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -Paperclip::Attachment.default_options[:read_timeout] = 60 +Paperclip.options[:read_timeout] = 60 if ENV['S3_ENABLED'] == 'true' Aws.eager_autoload!(services: %w(S3)) -- cgit From a097dd489b8530c179ecc65dba60fe06ed66ea3b Mon Sep 17 00:00:00 2001 From: Effy Elden Date: Sun, 15 Jan 2017 20:58:46 +1100 Subject: Change default S3 ACL string used by Paperclip from 'public' (which is invalid) to 'public-read' --- config/initializers/paperclip.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/initializers/paperclip.rb') diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 999ff47c7..71a7b514e 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -11,7 +11,7 @@ if ENV['S3_ENABLED'] == 'true' Paperclip::Attachment.default_options[:s3_host_name] = ENV.fetch('S3_HOSTNAME') { "s3-#{ENV.fetch('S3_REGION')}.amazonaws.com" } Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename' Paperclip::Attachment.default_options[:s3_headers] = { 'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate } - Paperclip::Attachment.default_options[:s3_permissions] = 'public' + Paperclip::Attachment.default_options[:s3_permissions] = 'public-read' Paperclip::Attachment.default_options[:s3_region] = ENV.fetch('S3_REGION') { 'us-east-1' } Paperclip::Attachment.default_options[:s3_credentials] = { -- cgit