Skip to content

Commit

Permalink
asrockrack: Rewind file read from beginning in uploadFirmware
Browse files Browse the repository at this point in the history
  • Loading branch information
ofaurax committed Nov 16, 2023
1 parent cb575b3 commit 32380ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions providers/asrockrack/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead
fieldName, fileName := "fwimage", "image"
contentLength := multipartSize(fieldName, fileName) + fileSize

// Before reading the file, rewind to the beginning
if file, ok := fwReader.(*os.File); ok {
file.Seek(0, 0)

Check failure on line 231 in providers/asrockrack/helpers.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `file.Seek` is not checked (errcheck)

Check failure on line 231 in providers/asrockrack/helpers.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `file.Seek` is not checked (errcheck)
}

// setup pipe
pipeReader, pipeWriter := io.Pipe()
defer pipeReader.Close()
Expand Down

0 comments on commit 32380ce

Please sign in to comment.