readme中变量图片相对路径 log error

This commit is contained in:
xxq250 2023-07-27 17:59:43 +08:00
parent 9e0404b24e
commit 06613493a3
1 changed files with 3 additions and 5 deletions

View File

@ -140,7 +140,6 @@ 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]
@ -153,8 +152,7 @@ module RepositoriesHelper
when 'ss_src_1'
content = content.gsub("src=\'#{s[0]}\'", "src=\'#{s_content}\'")
when 'ss_2'
Rails.logger.info( "##### new_readme_render_decode64_content1 s[0]: #{s[0]}")
content = content.gsub(/#{s[0]}/, "#{s_content}")
content = content.gsub(/]:#{s[0]}/, "]: #{s_content.to_s.gsub("","")}")
else
content = content.gsub("(#{s[0]})", "(#{s_content})")
end
@ -173,8 +171,8 @@ module RepositoriesHelper
content = content.gsub("(#{s[0]})", "(/#{s_content})")
end
end
# rescue
# next
rescue
next
end
end
end