Merge branch 'dev_trustie' into dev_chain

This commit is contained in:
sylor_huang@126.com 2020-07-02 10:13:17 +08:00
commit d5849976a3
3 changed files with 11 additions and 2 deletions

View File

@ -14,6 +14,12 @@ module RepositoriesHelper
default_type.include?(str&.downcase)
end
def is_readme_type?(str)
return false if str.blank?
readme_types = ["readme.md", "readme", "readme_en.md", "readme_zh.md", "readme_en", "readme_zh"]
readme_types.include?(str.to_s.downcase)
end
def render_commit_author(author_json)
return nil if author_json.blank?
find_user_by_login author_json['login']

View File

@ -12,7 +12,7 @@ json.target entry['target']
json.download_url entry['download_url']
json.direct_download direct_download
json.image_type image_type
json.is_readme_file is_readme_type?(file_name)
if entry['latest_commit']
json.partial! 'last_commit', entry: entry
end

View File

@ -18,12 +18,15 @@ json.entries do
json.type entry['type']
json.size entry['size']
content =
if entry['name'] === 'README.md'
if is_readme_type?(entry['name'])
is_readme_file = true
content = Gitea::Repository::Entries::GetService.call(@project_owner, @project.identifier, entry['name'], ref: @ref)['content']
readme_render_decode64_content(content, @path)
else
is_readme_file = false
entry['content']
end
json.is_readme_file is_readme_file
json.content content
json.target entry['target']
if entry['latest_commit']