fixed issue描述里的附件解析关联,增强附件访问权限控制

This commit is contained in:
xxq250 2023-10-18 15:16:14 +08:00 committed by kingchan
parent b40fcf5d63
commit 3362c78765
1 changed files with 1 additions and 1 deletions

View File

@ -231,7 +231,7 @@ class Issue < ApplicationRecord
att_ids += self.description.to_s.scan(/\/api\/attachments\/.+\"/).map{|s|s.match(/\d+/)[0]}
att_ids += self.description.to_s.scan(/\/api\/attachments\/\d+/).map{|s|s.match(/\d+/)[0]}
if att_ids.present?
Attachment.where(id: att_ids).where("container_type IS NULL OR container_type = 'Issue'").update_all(container_id: self.project_id, container_type: "Project")
Attachment.where(id: att_ids).where(container_type: nil).update_all(container_id: self.id, container_type: self.class.name)
end
end