change readme content
This commit is contained in:
parent
2ffeecf6f3
commit
dae013d386
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue