readme中变量图片相对路径 log error
This commit is contained in:
parent
9e0404b24e
commit
06613493a3
|
@ -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?
|
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 = File.extname(s_content)[1..-1]
|
||||||
ext = ext.split("?")[0] if ext.include?("?")
|
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?
|
if (image_type?(ext) || download_type(ext)) && !ext.blank?
|
||||||
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]
|
||||||
|
@ -153,8 +152,7 @@ module RepositoriesHelper
|
||||||
when 'ss_src_1'
|
when 'ss_src_1'
|
||||||
content = content.gsub("src=\'#{s[0]}\'", "src=\'#{s_content}\'")
|
content = content.gsub("src=\'#{s[0]}\'", "src=\'#{s_content}\'")
|
||||||
when 'ss_2'
|
when 'ss_2'
|
||||||
Rails.logger.info( "##### new_readme_render_decode64_content1 s[0]: #{s[0]}")
|
content = content.gsub(/]:#{s[0]}/, "]: #{s_content.to_s.gsub("","")}")
|
||||||
content = content.gsub(/#{s[0]}/, "#{s_content}")
|
|
||||||
else
|
else
|
||||||
content = content.gsub("(#{s[0]})", "(#{s_content})")
|
content = content.gsub("(#{s[0]})", "(#{s_content})")
|
||||||
end
|
end
|
||||||
|
@ -173,8 +171,8 @@ module RepositoriesHelper
|
||||||
content = content.gsub("(#{s[0]})", "(/#{s_content})")
|
content = content.gsub("(#{s[0]})", "(/#{s_content})")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rescue
|
rescue
|
||||||
# next
|
next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue