Skip to content

Commit

Permalink
repair GetFileContent: returns a raw byte response (ktrysmt#226)
Browse files Browse the repository at this point in the history
Co-authored-by: alexander_mazhaika <[email protected]>
  • Loading branch information
alex-mj and alex-mazhaika authored Dec 7, 2022
1 parent 1957d46 commit bcef472
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,13 @@ func (r *Repository) GetFileContent(ro *RepositoryFilesOptions) ([]byte, error)
return nil, err
}

response, err := r.c.execute("GET", urlStr, "")
resBody, err := r.c.executeRaw("GET", urlStr, "")
if err != nil {
return nil, err
}
defer resBody.Close()

content, ok := response.([]byte)
if !ok {
return nil, fmt.Errorf("requested path is not a file")
}

return content, nil
return ioutil.ReadAll(resBody)
}

func (r *Repository) ListFiles(ro *RepositoryFilesOptions) ([]RepositoryFile, error) {
Expand Down

0 comments on commit bcef472

Please sign in to comment.