Clean up partially-downloaded ZIP files if aborted
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.