-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix attachment download bug #27486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix attachment download bug #27486
Changes from all commits
07cf6d3
18dddd3
f4e027e
b6ea4ed
7d20598
b03470f
382c372
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,7 @@ | |
package convert | ||
|
||
import ( | ||
"strconv" | ||
|
||
repo_model "code.gitea.io/gitea/models/repo" | ||
"code.gitea.io/gitea/modules/setting" | ||
api "code.gitea.io/gitea/modules/structs" | ||
) | ||
|
||
|
@@ -16,12 +13,7 @@ func WebAssetDownloadURL(repo *repo_model.Repository, attach *repo_model.Attachm | |
} | ||
|
||
func APIAssetDownloadURL(repo *repo_model.Repository, attach *repo_model.Attachment) string { | ||
if attach.CustomDownloadURL != "" { | ||
return attach.CustomDownloadURL | ||
} | ||
|
||
// /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | ||
return setting.AppURL + "api/repos/" + repo.FullName() + "/releases/" + strconv.FormatInt(attach.ReleaseID, 10) + "/assets/" + strconv.FormatInt(attach.ID, 10) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would happen to Should this handler be removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it has been released, maybe deprecated is better. |
||
return attach.DownloadURL() | ||
} | ||
|
||
// ToAttachment converts models.Attachment to api.Attachment for API usage | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need the
repo
param anymore now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these function could be removed. To keep this PR small, I need another refactor PR to do that.