mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: broken query if upload id is missing (#9900)
Log warnings if there are any errors trying to upload group flair image and ensure upload.id exists before trying to use it in a sql query.
This commit is contained in:
parent
a9d92f338e
commit
a788427b46
@ -77,7 +77,11 @@ module Jobs
|
|||||||
origin: UrlHelper.absolute(old_url)
|
origin: UrlHelper.absolute(old_url)
|
||||||
).create_for(Discourse.system_user.id)
|
).create_for(Discourse.system_user.id)
|
||||||
|
|
||||||
DB.exec("UPDATE groups SET flair_url = NULL, flair_upload_id = #{upload.id} WHERE id = #{group.id}") if upload.present?
|
if upload.errors.count > 0
|
||||||
|
logger.warn("Failed to create upload for '#{group_name}' group_flair: #{upload.errors.full_messages}")
|
||||||
|
else
|
||||||
|
DB.exec("UPDATE groups SET flair_url = NULL, flair_upload_id = #{upload.id} WHERE id = #{group.id}") if upload&.id.present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user