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 17, 2023
1 parent df27af2 commit 07f29ef
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)
}

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

0 comments on commit 07f29ef

Please sign in to comment.