feat: persist resume metadata on SFTP single-file cancel
This commit is contained in:
@@ -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:
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user