fix: readme image regex error rescued
This commit is contained in:
parent
bc639488aa
commit
d0d906d04c
|
@ -57,6 +57,7 @@ module RepositoriesHelper
|
|||
total_images = ss + ss_src
|
||||
if total_images.length > 0
|
||||
total_images.each do |s|
|
||||
begin
|
||||
image_title = /\"(.*?)\"/
|
||||
r_content = s[0]
|
||||
remove_title = r_content.to_s.scan(image_title)
|
||||
|
@ -75,6 +76,9 @@ module RepositoriesHelper
|
|||
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{r_content}&ref=#{ref}"].join
|
||||
end
|
||||
content = content.gsub(/#{r_content}/, new_r_content)
|
||||
rescue
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,7 +100,9 @@ module RepositoriesHelper
|
|||
|
||||
def decode64_content(entry, owner, repo, ref, path=nil)
|
||||
if is_readme?(entry['type'], entry['name'])
|
||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
Rails.logger.info("content===#{content}")
|
||||
readme_render_decode64_content(content, owner, repo, ref)
|
||||
else
|
||||
file_type = File.extname(entry['name'].to_s)[1..-1]
|
||||
|
|
Loading…
Reference in New Issue