Skip to content

Commit c1f7fd5

Browse files
committed
Ensure that a 'Completed' download progress is always sent
1 parent 732bdc5 commit c1f7fd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: arduino/httpclient/httpclient.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func DownloadFile(path *paths.Path, URL string, label string, downloadCB rpc.Dow
5050
Url: d.URL,
5151
TotalSize: d.Size(),
5252
})
53+
defer downloadCB(&rpc.DownloadProgress{Completed: true})
5354

5455
err = d.RunAndPoll(func(downloaded int64) {
5556
downloadCB(&rpc.DownloadProgress{Downloaded: downloaded})
@@ -63,7 +64,6 @@ func DownloadFile(path *paths.Path, URL string, label string, downloadCB rpc.Dow
6364
return &arduino.FailedDownloadError{Message: tr("Server responded with: %s", d.Resp.Status)}
6465
}
6566

66-
downloadCB(&rpc.DownloadProgress{Completed: true})
6767
return nil
6868
}
6969

0 commit comments

Comments
 (0)