2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: enforce 'allow_uploaded_avatars' & 'sso_overrides_avatar' server-side

This commit is contained in:
Régis Hanol 2015-11-12 10:26:45 +01:00
parent 069516f4b4
commit 16f509afb9
4 changed files with 40 additions and 0 deletions

View file

@ -12,6 +12,12 @@ class UploadsController < ApplicationController
# HACK FOR IE9 to prevent the "download dialog"
response.headers["Content-Type"] = "text/plain" if request.user_agent =~ /MSIE 9/
if type == "avatar"
if SiteSetting.sso_overrides_avatar || !SiteSetting.allow_uploaded_avatars
return render json: failed_json, status: 422
end
end
if synchronous
data = create_upload(type, file, url)
render json: data.as_json