fixed: 文件目录加载性能优化
This commit is contained in:
parent
9912ad0779
commit
930805704a
|
@ -224,7 +224,7 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@owner.login}/#{@repository.identifier}/raw/branch/#{params[:ref]}/"
|
||||
@readme = result[:status] === :success ? result[:body] : nil
|
||||
@readme['content'] = decode64_readme_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
render json: @readme.slice("type", "encoding", "size", "name", "path", "content", "sha")
|
||||
rescue
|
||||
render json: nil
|
||||
|
|
|
@ -110,18 +110,10 @@ module RepositoriesHelper
|
|||
date.to_time.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
|
||||
def decode64_readme_content(entry, owner, repo, ref, path=nil)
|
||||
if is_readme?(entry['type'], entry['name'])
|
||||
path = URI.escape(entry['path']).to_s.downcase.gsub("/readme.md","")
|
||||
readme_render_decode64_content(entry['content'], owner, repo, ref, path)
|
||||
else
|
||||
render_decode64_content(entry['content'])
|
||||
end
|
||||
end
|
||||
|
||||
def decode64_content(entry, owner, repo, ref, path=nil)
|
||||
if is_readme?(entry['type'], entry['name'])
|
||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
# content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
content = entry['content']
|
||||
path = URI.escape(entry['path']).to_s.downcase.gsub("/readme.md","")
|
||||
readme_render_decode64_content(content, owner, repo, ref, path)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue