Remove downloaded result on json failure

This commit is contained in:
Timmy Welch 2024-10-19 09:41:42 -07:00
parent 776ca68e3e
commit 50fcfb9513

View File

@ -282,7 +282,8 @@ func (c *CVDownloader) updateIssues() {
}
body := io.TeeReader(resp.Body, file)
err = json.NewDecoder(bufio.NewReader(body)).Decode(issue)
if err != nil {
if err != nil || issue.Offset != offset {
os.Remove(filepath.Join(c.JSONPath, "cv-"+strconv.Itoa(offset)+".json"))
cancelDownloadCTX()
if retry(URI.String(), err) {
continue