mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
add image authorization on upload_avatar
This commit is contained in:
@ -302,6 +302,10 @@ class UsersController < ApplicationController
|
||||
|
||||
file = params[:file] || params[:files].first
|
||||
|
||||
unless SiteSetting.authorized_image?(file)
|
||||
return render status: 422, text: I18n.t("upload.images.unknown_image_type")
|
||||
end
|
||||
|
||||
# check the file size (note: this might also be done in the web server)
|
||||
filesize = File.size(file.tempfile)
|
||||
max_size_kb = SiteSetting.max_image_size_kb * 1024
|
||||
|
Reference in New Issue
Block a user