fix: readme image regex error rescued
This commit is contained in:
parent
4c69c4d20f
commit
a5be4a9502
|
@ -59,6 +59,7 @@ module RepositoriesHelper
|
||||||
total_images = ss + ss_src + ss_src2
|
total_images = ss + ss_src + ss_src2
|
||||||
if total_images.length > 0
|
if total_images.length > 0
|
||||||
total_images.each do |s|
|
total_images.each do |s|
|
||||||
|
begin
|
||||||
image_title = /\"(.*?)\"/
|
image_title = /\"(.*?)\"/
|
||||||
r_content = s[0]
|
r_content = s[0]
|
||||||
remove_title = r_content.to_s.scan(image_title)
|
remove_title = r_content.to_s.scan(image_title)
|
||||||
|
@ -91,6 +92,9 @@ module RepositoriesHelper
|
||||||
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{path_current}/#{path_last}&ref=#{ref}"].join
|
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{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
|
||||||
|
next
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue