Skip to content

Commit 11a439b

Browse files
authored
fix(backend): correct authorization header assembly (#315)
Signed-off-by: chlins <[email protected]>
1 parent 329fc89 commit 11a439b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/backend/pull_by_d7y.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ 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+
// Assemble the full authorization token by prepending the scheme (e.g., "Bearer" or "Basic").
167+
return fmt.Sprintf("%s %s", scheme, token), nil
167168
}
168169

169170
// buildBlobURL constructs the URL for a blob.
@@ -232,7 +233,7 @@ func downloadAndExtractLayer(ctx context.Context, pb *internalpb.ProgressBar, cl
232233
Type: common.TaskType_STANDARD,
233234
Priority: common.Priority_LEVEL6,
234235
RequestHeader: map[string]string{
235-
"Authorization": fmt.Sprintf("Bearer %s", authToken),
236+
"Authorization": authToken,
236237
},
237238
OutputPath: &outputPath,
238239
ForceHardLink: false,

0 commit comments

Comments
 (0)