Skip to content

Commit

Permalink
Merge pull request #902 from tekton-robot/cherry-pick-901-to-release-…
Browse files Browse the repository at this point in the history
…v0.13.x

[release-v0.13.x] Fix the Unauthorized for the Rest API
  • Loading branch information
khrm authored Dec 10, 2024
2 parents d22dbb9 + 5f8a680 commit 683497f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/api/server/v1alpha2/plugin/plugin_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func getBlobLogs(s *LogServer, writer io.Writer, parent string, rec *db.Record)
iter := bucket.List(&blob.ListOptions{
Prefix: strings.TrimPrefix(s.config.LOGS_PATH+fmt.Sprintf(defaultBlobPathParams, parent, rec.ResultName, rec.Name), "/"),
})
s.logger.Debugf("prefix: %s", strings.TrimPrefix(s.config.LOGS_PATH+"/"+fmt.Sprintf(defaultBlobPathParams, parent, rec.ResultName, rec.Name)+"/", "/"))
s.logger.Debugf("prefix: %s", strings.TrimPrefix(s.config.LOGS_PATH+fmt.Sprintf(defaultBlobPathParams, parent, rec.ResultName, rec.Name), "/"))
for {
obj, err := iter.Next(ctx)
if err == io.EOF {
Expand Down Expand Up @@ -407,7 +407,8 @@ func (s *LogServer) LogMux() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// TODO: Create a new log handler
ctx := r.Context()
ctx = metadata.AppendToOutgoingContext(ctx, "authorization", r.Header.Get("Authorization"))
md := metadata.New(map[string]string{"authorization": r.Header.Get("Authorization")})
ctx = metadata.NewIncomingContext(ctx, md)
parent := r.PathValue("parent")
if err := s.auth.Check(ctx, parent, auth.ResourceLogs, auth.PermissionGet); err != nil {
s.logger.Error(err)
Expand Down

0 comments on commit 683497f

Please sign in to comment.