更改:readme href替换

This commit is contained in:
yystopf 2024-03-13 16:10:43 +08:00
parent 370a565a7c
commit 7d769ad118
1 changed files with 1 additions and 3 deletions

View File

@ -137,11 +137,9 @@ module RepositoriesHelper
sources.each do |s|
begin
s_content = s[0]
puts s_content
# 链接直接跳过不做替换
next if s_content.starts_with?('http://') || s_content.starts_with?('https://') || s_content.starts_with?('mailto:') || s_content.blank?
ext = File.extname(s_content)[1..-1]
puts ext
if (image_type?(ext) || download_type(ext)) && !ext.blank?
s_content = File.expand_path(s_content, file_path)
s_content = s_content.split("#{Rails.root}/")[1]
@ -162,7 +160,7 @@ module RepositoriesHelper
else
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]
s_content = s_content.split("#{Rails.root}")[1]
case k.to_s
when 'ss_src'
content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"")