From 50fcfb951345e3510765348b27e0f0bf614c7f58 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sat, 19 Oct 2024 09:41:42 -0700 Subject: [PATCH] Remove downloaded result on json failure --- cv/cv.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cv/cv.go b/cv/cv.go index 577679f..7490e6d 100644 --- a/cv/cv.go +++ b/cv/cv.go @@ -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