新增:entry新增submodule url
This commit is contained in:
parent
4bc945028b
commit
39ae14bce7
|
@ -198,4 +198,12 @@ module RepositoriesHelper
|
|||
"repo"
|
||||
end
|
||||
|
||||
def repo_git_submodule_url(owner, repo, path)
|
||||
unless (path.starts_with?('http://') || path.starts_with?('https://'))
|
||||
path = File.expand_path(path, "#{base_url}/#{owner&.login}/#{repo&.identifier}")
|
||||
path = path.split("#{Rails.root}/")[1]
|
||||
end
|
||||
|
||||
return path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ if @project.forge?
|
|||
json.sha entry['sha']
|
||||
json.path entry['path']
|
||||
json.type entry['type']
|
||||
json.submodule_git_url repo_git_submodule_url(@owner, @repository, entry['submodule_git_url'])
|
||||
json.size entry['size']
|
||||
is_readme = is_readme?(entry['type'], entry['name'])
|
||||
if is_readme
|
||||
|
|
|
@ -51,6 +51,7 @@ if @project.forge?
|
|||
json.path entry['path']
|
||||
json.sha entry['sha']
|
||||
json.type entry['type']
|
||||
json.submodule_git_url repo_git_submodule_url(@owner, @repository, entry['submodule_git_url'])
|
||||
json.size entry['size']
|
||||
json.is_readme_file is_readme?(entry['type'], entry['name'])
|
||||
json.content decode64_content(entry, @owner, @repository, @ref, @path)
|
||||
|
|
Loading…
Reference in New Issue