From a73c3bb44af4294d8a1471c22c1bd1d7d0309675 Mon Sep 17 00:00:00 2001 From: yystopf Date: Sat, 28 Feb 2026 14:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9Aget=5Ffile=E6=96=9C?= =?UTF-8?q?=E6=9D=A0=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 200ad55e3..6db403265 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -42,8 +42,9 @@ class AttachmentsController < ApplicationController domain = GiteaService.gitea_config[:domain] api_url = GiteaService.gitea_config[:base_url] url = ("/repos"+url.split(base_url + "/api")[1]) - filepath, ref = url.split("/")[-1].split("?") - url.gsub!(url.split("/")[-1], '') + ref = url.split("?")[1] + filepath = url.split("?")[0].split("/")[-1] + url.gsub!(filepath+"?"+ref, '') # Rails.logger.info("url===#{url}") Rails.logger.info(filepath) ref = ref.blank? ? "" : URI.escape(ref.split('ref=')[1])