feat: persist resume metadata on SFTP single-file cancel

This commit is contained in:
2026-06-29 11:53:14 +02:00
parent 53db81e1f7
commit 277178776d
2 changed files with 91 additions and 0 deletions
+8
View File
@@ -725,6 +725,14 @@ func downloadSingleFile(ctx context.Context, c *client, req *core.DownloadReques
for {
select {
case <-ctx.Done():
// Persist partial progress so the user can resume later
// with --resume. Unconditional — mirrors the FTP and SFTP
// parallel paths that always save a .goget.meta sidecar on
// cancellation.
if outputPath != "" && outputPath != "-" && total > 0 {
meta := output.NewResumeMetadata(req.URL.String(), "", "", int64(total), totalSize)
_ = meta.Save(outputPath)
}
return nil, ctx.Err()
default:
}