Skip to content

Commit 936d927

Browse files
committed
fixed ota upload
1 parent 3548bbc commit 936d927

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/iot/client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,11 @@ func (cl *Client) DeviceOTA(ctx context.Context, id string, file *os.File, expir
206206
req := cl.api.DevicesV2OtaApi.DevicesV2OtaUpload(ctx, id)
207207
req = req.ExpireInMins(int32(expireMins))
208208
req = req.Async(true)
209+
req = req.OtaFile(file)
209210
_, resp, err := cl.api.DevicesV2OtaApi.DevicesV2OtaUploadExecute(req)
210211
if err != nil {
211212
// 409 (Conflict) is the status code for an already existing OTA in progress for the same device. Handling it in a different way.
212-
if resp.StatusCode == 409 {
213+
if resp != nil && resp.StatusCode == 409 {
213214
return ErrOtaAlreadyInProgress
214215
}
215216
return fmt.Errorf("uploading device ota: %w", errorDetail(err))

0 commit comments

Comments
 (0)