From 60c8b25075b42d2c4ff31dbfd1072126247bd759 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 12 Dec 2023 16:57:39 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E8=A7=A3=E5=86=B3=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=AE=BF=E9=97=AE=E9=99=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?id=E6=94=B9=E4=B8=BAuuid,=E6=9F=A5=E7=9C=8B=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index bf8c870a0..ecc4760b5 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -144,11 +144,12 @@ class AttachmentsController < ApplicationController private def find_file + tip_exception(404, "您访问的页面不存在或已被删除") if params[:id].blank? @file = if params[:type] == 'history' AttachmentHistory.find params[:id] else - Attachment.find_by(id: params[:id]) || Attachment.find_by(uuid: params[:id]) + Attachment.where_id_or_uuid(params[:id]).first end tip_exception(404, "您访问的页面不存在或已被删除") if @file.blank? end