Skip to content

Commit ba5b90c

Browse files
authored
fix(cas-redirection): Avoid returning URL when CAS is not valid (#2796)
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
1 parent 05af24f commit ba5b90c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/controlplane/internal/service/casredirect.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023 The Chainloop Authors.
2+
// Copyright 2023-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -110,6 +110,11 @@ func (s *CASRedirectService) GetDownloadURL(ctx context.Context, req *pb.GetDown
110110
return nil, kerrors.NotFound("not found", "CAS backend is inline")
111111
}
112112

113+
// check if the backend is on a valid state, if not return an error
114+
if backend.ValidationStatus != biz.CASBackendValidationOK {
115+
return nil, pb.ErrorCasBackendErrorReasonInvalid("CAS Storage is in an invalid state and can't download artifacts, please fix it before attempting it again")
116+
}
117+
113118
// Create an URL to download the artifact from the CAS backend
114119
downloadBase, err := url.Parse(s.casServerConf.GetDownloadUrl())
115120
if err != nil {

0 commit comments

Comments
 (0)