Skip to content

Clean up partially-downloaded ZIP files if aborted

Warren Gifford requested to merge mrn/clean-up-partial-zips into main

Created by: mrnugget

This fixes https://github.com/sourcegraph/sourcegraph/issues/15865

This fixes a bug where src-cli would leave partially-downloaded ZIP files behind when the user hit Ctrl-C while a download was ongoing.

The fetchRepositoryArchive would then run into a context-cancelation error when doing the request or the io.Copy and not clean up the file.

The code here checks whether the cause of the error is a cancelation and, if so, cleans up the zip file.

Merge request reports

Loading