From 33138aed80aa8a6469bfe511289350fd38e81ee6 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 12 May 2025 16:00:23 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20readme=E8=B7=AF=E5=BE=84=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 4 +++- app/models/commit_log.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 24eb7c5bb..3ad563e0e 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -161,6 +161,7 @@ module RepositoriesHelper s_content = s_content.starts_with?("/") ? s_content[1..-1] : s_content[0..-1] s_content = File.expand_path(s_content, file_path) s_content = s_content.split("#{Rails.root}/")[1] + next if s_content.blank? # content = content.gsub(s[0], "/#{s_content}") join_xxx = s_content.include?("?") ? "&" : "?" s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join @@ -190,6 +191,7 @@ module RepositoriesHelper path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/") s_content = File.expand_path(s_content, path) s_content = s_content.split("#{Rails.root}")[1] + next if s_content.blank? case k.to_s when 'ss_src' content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"") @@ -202,7 +204,7 @@ module RepositoriesHelper when 'ss_href_1' content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'") else - content = content.gsub("(#{s[0]})", "(/#{s_content})") + content = content.gsub("(#{s[0]})", "(#{s_content})") end end rescue diff --git a/app/models/commit_log.rb b/app/models/commit_log.rb index d351e6f48..5f9b6c3f8 100644 --- a/app/models/commit_log.rb +++ b/app/models/commit_log.rb @@ -24,7 +24,7 @@ class CommitLog < ApplicationRecord belongs_to :user belongs_to :project - belongs_to :repository + # belongs_to :repository has_many :project_trends, as: :trend, dependent: :destroy