Loading
fix(release): report a failed close and remove a partial asset
Re-lands !3562 (closed) by @ihopenre-eng on current main, since that MR went stale with conflicts. The commit keeps them as author.
glab release download dropped the error from closing the asset file and left a partial file behind when a download failed, so the next attempt failed with "file exists". The close error is now returned, and the file is removed on any failure.
Changes from !3562 (closed)
- Resolved the conflict with the
url.Parsecheck and the Markdown-upload download path that landed onmainafter !3562 (closed) was opened. The deferred cleanup covers both. Test_downloadAsset_RemovesPartialFileOnErrorStatusis now table-driven and also covers the Markdown-upload path. Both cases fail with theos.Removedisabled.- A failed
os.Removeis joined into the returned error, so a file that could not be cleaned up is reported instead of silently left behind. - Squashed the three commits into one and trimmed the comments.
Not covered by tests: the close-error half. Making *os.File.Close fail would need an interface seam, which is out of proportion for this change.
Closes #8429 (closed)
Edited by Jay McCure