Skip to content

Commit bcef472

Browse files
repair GetFileContent: returns a raw byte response (ktrysmt#226)
Co-authored-by: alexander_mazhaika <[email protected]>
1 parent 1957d46 commit bcef472

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

repository.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,13 @@ func (r *Repository) GetFileContent(ro *RepositoryFilesOptions) ([]byte, error)
309309
return nil, err
310310
}
311311

312-
response, err := r.c.execute("GET", urlStr, "")
312+
resBody, err := r.c.executeRaw("GET", urlStr, "")
313313
if err != nil {
314314
return nil, err
315315
}
316+
defer resBody.Close()
316317

317-
content, ok := response.([]byte)
318-
if !ok {
319-
return nil, fmt.Errorf("requested path is not a file")
320-
}
321-
322-
return content, nil
318+
return ioutil.ReadAll(resBody)
323319
}
324320

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

0 commit comments

Comments
 (0)