Skip to content

Commit 41addc2

Browse files
committed
fix(backend): correct authorization header assembly
Signed-off-by: chlins <chlins.zhang@gmail.com>
1 parent 329fc89 commit 41addc2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/backend/pull_by_d7y.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ func getAuthToken(ctx context.Context, src *remote.Repository, registry, repo st
163163
return "", fmt.Errorf("failed to empty token from cache")
164164
}
165165

166-
return token, nil
166+
// As the basic and bearer with different auth prefix, let's assemble
167+
// the scheme as prefix.
168+
return fmt.Sprintf("%s %s", scheme, token), nil
167169
}
168170

169171
// buildBlobURL constructs the URL for a blob.
@@ -232,7 +234,7 @@ func downloadAndExtractLayer(ctx context.Context, pb *internalpb.ProgressBar, cl
232234
Type: common.TaskType_STANDARD,
233235
Priority: common.Priority_LEVEL6,
234236
RequestHeader: map[string]string{
235-
"Authorization": fmt.Sprintf("Bearer %s", authToken),
237+
"Authorization": authToken,
236238
},
237239
OutputPath: &outputPath,
238240
ForceHardLink: false,

0 commit comments

Comments
 (0)