Skip to content

Commit 7861808

Browse files
committed
fix test
1 parent e6629fc commit 7861808

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

routers/api/v1/repo/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ func DownloadArtifactRaw(ctx *context.APIContext) {
11951195
expires := ctx.Req.URL.Query().Get("expires")
11961196
sigBytes, _ := base64.URLEncoding.DecodeString(sigStr)
11971197

1198-
expectedSig := buildSignature(buildDownloadRawEndpoint(ctx.Repo.Repository, art.ID), expires, art.ID)
1198+
expectedSig := buildSignature(buildDownloadRawEndpoint(repo, art.ID), expires, art.ID)
11991199
if !hmac.Equal(sigBytes, expectedSig) {
12001200
ctx.Error(http.StatusUnauthorized, "DownloadArtifactRaw", "Error unauthorized")
12011201
return

tests/integration/api_actions_artifact_v4_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,10 @@ func TestActionsArtifactV4DownloadRawArtifactMismatchedRepoOwnerMissingSignature
536536
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
537537

538538
// confirm artifacts of wrong owner or repo is not visible
539+
// TODO: is this test right? `zip/raw` endpoint doesn't use the token?
539540
req := NewRequestWithBody(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/artifacts/%d/zip/raw", repo.FullName(), 22), nil).
540541
AddTokenAuth(token)
541-
MakeRequest(t, req, http.StatusUnauthorized)
542+
MakeRequest(t, req, http.StatusNotFound)
542543
}
543544

544545
func TestActionsArtifactV4DownloadRawArtifactCorrectRepoOwnerMissingSignatureUnauthorized(t *testing.T) {

0 commit comments

Comments
 (0)