From 9a0809e45babd52ed599dfd227aacc554b351654 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 12 Dec 2023 15:33:48 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=8F=91=E8=A1=8C=E7=89=88=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/version_releases_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/version_releases_controller.rb b/app/controllers/version_releases_controller.rb index 76a214d0f..62724c12d 100644 --- a/app/controllers/version_releases_controller.rb +++ b/app/controllers/version_releases_controller.rb @@ -152,11 +152,12 @@ class VersionReleasesController < ApplicationController def create_attachments(attachment_ids, target) attachment_ids.each do |id| - attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id) + attachment = Attachment.select(:id, :container_id, :container_type).where(id: id).or(Attachment.where(uuid: id))&.first unless attachment.blank? attachment.container = target attachment.author_id = current_user.id attachment.description = "" + attachment.uuid = SecureRandom.uuid attachment.save end end