修复:&to?

This commit is contained in:
yystopf 2023-04-21 14:22:38 +08:00
parent 6c26450924
commit 67d7d11c62
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ module RepositoriesHelper
unless r_content.include?("http://") || r_content.include?("https://") || r_content.include?("mailto:") unless r_content.include?("http://") || r_content.include?("https://") || r_content.include?("mailto:")
# new_r_content = "#{path}" + new_r_content # new_r_content = "#{path}" + new_r_content
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{path_current}/#{path_last}&ref=#{ref}"].join new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{path_current}/#{path_last}?ref=#{ref}"].join
end end
content = content.gsub(/src=\"#{r_content}\"/, "src=\"#{new_r_content}\"").gsub(/src='#{r_content}'/, "src=\"#{new_r_content}\"") content = content.gsub(/src=\"#{r_content}\"/, "src=\"#{new_r_content}\"").gsub(/src='#{r_content}'/, "src=\"#{new_r_content}\"")
rescue rescue
@ -132,7 +132,7 @@ module RepositoriesHelper
s_content = File.expand_path(s_content, file_path) s_content = File.expand_path(s_content, file_path)
s_content = s_content.split("#{Rails.root}/")[1] s_content = s_content.split("#{Rails.root}/")[1]
# content = content.gsub(s[0], "/#{s_content}") # content = content.gsub(s[0], "/#{s_content}")
s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}&ref=#{ref}"].join s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}?ref=#{ref}"].join
case k.to_s case k.to_s
when 'ss_src' when 'ss_src'
content = content.gsub("src=\"#{s[0]}\"", "src=\"#{s_content}\"") content = content.gsub("src=\"#{s[0]}\"", "src=\"#{s_content}\"")