Use rails configuration storage for paperclip path (#31651)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2024-08-30 09:46:09 +00:00
1 parent 3ddeaca863
commit 85e8d1f285
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -160,9 +160,10 @@ elsif ENV['AZURE_ENABLED'] == 'true'
)
end
else
Rails.configuration.x.file_storage_root_path = ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system'))
Paperclip::Attachment.default_options.merge!(
storage: :filesystem,
path: File.join(ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')), ':prefix_path:class', ':attachment', ':id_partition', ':style', ':filename'),
path: File.join(Rails.configuration.x.file_storage_root_path, ':prefix_path:class', ':attachment', ':id_partition', ':style', ':filename'),
url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + "/#{PATH}"
)
end
+1 -1
View File
@@ -157,7 +157,7 @@ module Mastodon::CLI
when :filesystem
require 'find'
root_path = ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')).gsub(':rails_root', Rails.root.to_s)
root_path = Rails.configuration.x.file_storage_root_path.gsub(':rails_root', Rails.root.to_s)
Find.find(File.join(*[root_path, prefix].compact)) do |path|
next if File.directory?(path)