From 4c51feae24eb06998d6b7e1cc3c4c50fc0ccaba3 Mon Sep 17 00:00:00 2001 From: jasder duan Date: Tue, 31 Mar 2026 15:41:35 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E9=99=84=E4=BB=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9oss=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index e243ae539..c2661866f 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -196,17 +196,7 @@ class Attachment < ApplicationRecord end def get_cloud_url(disposition="attachment") - if (self.container_type == "Shixun" && [11, 12, 13].include?(self.attachtype)) || - ((["VirtualClassroomGoodLesson", "VirtualClassroomDiscussion", "Course"].include?(self.container_type)) && self.attachtype == 11) || - (self.container_type == "VirtualClassroomGoodLesson" && self.attachtype == 30) || - (self.container_type == "VirtualClassroomDiscussion" && self.attachtype == 31) - cloud_url = self.oss_absolute_url - elsif self.digest.start_with?(SLUG_PREFIX) - bucket = %w[SmartPlan].include?(self.container_type) ? OSS.client.get_bucket(OSS.bucket_big_files) : OSS.client.get_bucket(OSS.attachments_oss_bucket) - cloud_url = bucket.object_url(self.cloud_url, true, 10 * 3600 * 24, {"response-content-disposition": "attachment;\"filename=#{URI.encode(self.filename.strip)}\";attachment_id=#{self.id}"}) - elsif ["Stage", "Course"].include?(self.container_type) && OSS.client.get_bucket(OSS.bucket_big_files).object_exists?(self.cloud_url) - cloud_url = ApplicationController.helpers.cdn_a_auth_url(self) - elsif self.cloud_url.include?("http") + if self.cloud_url.include?("http") cloud_url = self.cloud_url else bucket = OSS.client.get_bucket(OSS.attachments_oss_bucket)