DEV: allow plugins to override max file size for avatar downloads (#16970)

This commit is contained in:
Jeff Wong 2022-06-01 14:12:06 -10:00 committed by GitHub
parent 0bbbd8371e
commit 2dd09b4b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -142,6 +142,11 @@ class UserAvatarsController < ApplicationController
render_blank
end
# Allow plugins to overwrite max file size value
def max_file_size
1.megabyte
end
PROXY_PATH = Rails.root + "tmp/avatar_proxy"
def proxy_avatar(url, last_modified)
@ -157,7 +162,7 @@ class UserAvatarsController < ApplicationController
FileUtils.mkdir_p PROXY_PATH
tmp = FileHelper.download(
url,
max_file_size: 1.megabyte,
max_file_size: max_file_size,
tmp_file_name: filename,
follow_redirect: true,
read_timeout: 10