更改:下载文件以及查看文件逻辑

This commit is contained in:
2023-04-12 14:51:27 +08:00
parent ccede16716
commit 0830850518
5 changed files with 19 additions and 15 deletions

View File

@@ -17,14 +17,15 @@ if @project.forge?
json.content (direct_download || image_type || is_dir) ? nil : decode64_content(entry, @owner, @repository, @ref, @path)
json.target entry['target']
download_url =
if image_type
dir_path = [@owner.login, @repository.identifier, "raw/branch", @ref].join('/')
is_dir ? "" : render_download_image_url(dir_path, entry['path'], decode64_content(entry, @owner, @repository, @ref))
else
# entry['download_url']
is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
end
download_url = is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
# if image_type
# # dir_path = [@owner.login, @repository.identifier, "raw/branch", @ref].join('/')
# # is_dir ? "" : render_download_image_url(dir_path, entry['path'], decode64_content(entry, @owner, @repository, @ref))
# is_dir ? "" : render_gitea_raw_url(entry['download_url'])
# else
# # entry['download_url']
# is_dir ? "" : render_download_file_url(@owner, @repository, entry['path'].to_s, @ref)
# end
json.download_url download_url
json.direct_download direct_download