readme中变量图片相对路径 log error
This commit is contained in:
parent
d9cc7f43b5
commit
8197e30069
|
@ -140,13 +140,13 @@ module RepositoriesHelper
|
|||
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]
|
||||
ext = ext.split("?")[0] if ext.include?("?")
|
||||
Rails.logger.info( "##### new_readme_render_decode64_content k.to_s: #{k.to_s}, s[0] :#{s[0]}")
|
||||
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]
|
||||
# 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
|
||||
Rails.logger.info( "##### new_readme_render_decode64_content k.to_s: #{k.to_s}")
|
||||
case k.to_s
|
||||
when 'ss_src'
|
||||
content = content.gsub("src=\"#{s[0]}\"", "src=\"#{s_content}\"")
|
||||
|
|
Loading…
Reference in New Issue