仓库releases文件下载链接构建,文件后缀路由,直接下载
This commit is contained in:
parent
5e9621d8d7
commit
0dc4ecbfb8
|
@ -131,7 +131,9 @@ class VersionReleasesController < ApplicationController
|
|||
version = @repository.version_releases.find_by(tag_name: params["tag_name"])
|
||||
attachment = version.attachments.find_by(filename: params["filename"])
|
||||
tip_exception(404, '您访问的页面不存在或已被删除') if attachment.blank?
|
||||
redirect_to "/api/attachments/#{attachment.uuid}"
|
||||
send_file(absolute_path(local_path(attachment)), filename: attachment.title, stream: false, type: attachment.content_type.presence || 'application/octet-stream')
|
||||
update_downloads(attachment)
|
||||
# redirect_to "/api/attachments/#{attachment.uuid}"
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue