mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:37:06 +08:00
Merge pull request #2708 from Wilhansen/sso_override_avatar
Fix SSO avatar downloading issues.
This commit is contained in:
commit
5b696ca25a
|
@ -126,10 +126,12 @@ class DiscourseSingleSignOn < SingleSignOn
|
||||||
avatar_force_update.to_i != 0 ||
|
avatar_force_update.to_i != 0 ||
|
||||||
sso_record.external_avatar_url != avatar_url)
|
sso_record.external_avatar_url != avatar_url)
|
||||||
begin
|
begin
|
||||||
tempfile = FileHelper.download(avatar_url, 1.megabyte, "sso-avatar")
|
tempfile = FileHelper.download(avatar_url, 1.megabyte, "sso-avatar", true)
|
||||||
|
|
||||||
upload = Upload.create_for(user.id, tempfile, "external-avatar", File.size(tempfile.path), { origin: avatar_url })
|
ext = FastImage.type(tempfile).to_s
|
||||||
|
tempfile.rewind
|
||||||
|
|
||||||
|
upload = Upload.create_for(user.id, tempfile, "external-avatar." + ext, File.size(tempfile.path), { origin: avatar_url })
|
||||||
user.uploaded_avatar_id = upload.id
|
user.uploaded_avatar_id = upload.id
|
||||||
|
|
||||||
if !user.user_avatar.contains_upload?(upload.id)
|
if !user.user_avatar.contains_upload?(upload.id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user