Skip to content

Commit

Permalink
Update cluster.go
Browse files Browse the repository at this point in the history
  • Loading branch information
MGamya committed Jun 1, 2024
1 parent d3781ec commit 858335f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"

clientV1 "github.com/spectrocloud/palette-api-go/client/v1"
Expand Down Expand Up @@ -280,10 +281,13 @@ func (h *V1Client) DownloadLogs(uid string,logFetcherUid string) (io.Writer,erro
return nil,err
}
file_location := "/tmp/"+filename
fo, err := os.Create(file_location)
fo, err := os.Create(filepath.Clean(file_location))
if err != nil {
return nil, fmt.Errorf("error while creting a file %v",err)
return nil, fmt.Errorf("error while creating a file %v",err)
}
_, err = buf.WriteTo(fo)
if err != nil {
return nil, fmt.Errorf("error while writing log content to a file %v",err)
}
buf.WriteTo(fo)
return logfile,nil
}

0 comments on commit 858335f

Please sign in to comment.