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 24, 2023
1 parent fd2f0a8 commit b565dd4
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 b565dd4

Please sign in to comment.