fix: educoder entries image file type
This commit is contained in:
parent
38d6519381
commit
81e6691632
|
@ -32,6 +32,8 @@ end
|
||||||
|
|
||||||
if @project.educoder?
|
if @project.educoder?
|
||||||
file_path = params[:filepath].present? ? [params[:filepath], entry['name']].join('/') : entry['name']
|
file_path = params[:filepath].present? ? [params[:filepath], entry['name']].join('/') : entry['name']
|
||||||
|
file_type = File.extname(entry['name'].to_s)[1..-1]
|
||||||
|
image_type = image_type?(file_type)
|
||||||
|
|
||||||
json.name entry['name']
|
json.name entry['name']
|
||||||
json.sha nil
|
json.sha nil
|
||||||
|
@ -42,7 +44,7 @@ if @project.educoder?
|
||||||
json.target nil
|
json.target nil
|
||||||
json.download_url nil
|
json.download_url nil
|
||||||
json.direct_download false
|
json.direct_download false
|
||||||
json.image_type false
|
json.image_type image_type
|
||||||
json.is_readme_file false
|
json.is_readme_file false
|
||||||
json.commit do
|
json.commit do
|
||||||
json.message entry['title']
|
json.message entry['title']
|
||||||
|
|
|
@ -24,6 +24,12 @@ if @project.educoder?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
json.entries do
|
json.entries do
|
||||||
json.partial! 'repositories/simple_entry', locals: { entry: @sub_entries['trees']}
|
if @sub_entries['trees'].is_a?(Array)
|
||||||
|
json.array! @sub_entries['trees'] do |entry|
|
||||||
|
json.partial! 'repositories/simple_entry', locals: { entry: entry }
|
||||||
|
end
|
||||||
|
elsif @sub_entries['trees'].is_a?(Hash)
|
||||||
|
json.partial! 'repositories/simple_entry', locals: { entry: @sub_entries['trees'] }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue