mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 00:24:39 +08: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:
@ -77,7 +77,11 @@ module Jobs
|
||||
origin: UrlHelper.absolute(old_url)
|
||||
).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
|
||||
|
||||
|
Reference in New Issue
Block a user