Skip to content

Commit 8e48777

Browse files
committed
fix comment
1 parent 7861808 commit 8e48777

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ func Routes() *web.Router {
14091409
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryRepository))
14101410

14111411
// Artifacts direct download endpoint authenticates via signed url
1412-
// TODO: need to clarify whether to use repoAssignment or not
1412+
// it is protected by the "sig" parameter (to help to access private repo), so no need to use other middlewares
14131413
m.Get("/repos/{username}/{reponame}/actions/artifacts/{artifact_id}/zip/raw", repo.DownloadArtifactRaw)
14141414

14151415
// Notifications (requires notifications scope)

routers/api/v1/repo/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ func buildSignature(endp, expires string, artifactID int64) []byte {
11031103
}
11041104

11051105
func buildDownloadRawEndpoint(repo *repo_model.Repository, artifactID int64) string {
1106-
return fmt.Sprintf("api/v1/repos/%s/%s//actions/artifacts/%d/zip/raw", url.PathEscape(repo.OwnerName), url.PathEscape(repo.Name), artifactID)
1106+
return fmt.Sprintf("api/v1/repos/%s/%s/actions/artifacts/%d/zip/raw", url.PathEscape(repo.OwnerName), url.PathEscape(repo.Name), artifactID)
11071107
}
11081108

11091109
func buildSigURL(ctx go_context.Context, endPoint string, artifactID int64) string {
@@ -1176,7 +1176,7 @@ func DownloadArtifact(ctx *context.APIContext) {
11761176

11771177
// DownloadArtifactRaw Downloads a specific artifact for a workflow run directly.
11781178
func DownloadArtifactRaw(ctx *context.APIContext) {
1179-
// TODO: if it needs to skip "repoAssignment" middleware, it could query the repo from path params: ctx.PathParam("username"), ctx.PathParam("reponame")
1179+
// it doesn't use repoAssignment middleware, so it needs to prepare the repo and check permission (sig) by itself
11801180
repo, err := repo_model.GetRepositoryByOwnerAndName(ctx, ctx.PathParam("username"), ctx.PathParam("reponame"))
11811181
if err != nil {
11821182
if errors.Is(err, util.ErrNotExist) {

0 commit comments

Comments
 (0)