fix(gemini): reject resume when caller supplies Writer

This commit is contained in:
2026-06-30 20:09:54 +02:00
parent c1373f0d61
commit 3752b3d3eb
+10
View File
@@ -207,6 +207,16 @@ func (p *Protocol) downloadWithRedirects(ctx context.Context, req *core.Download
// fresh downloads (create) and resume (append). When req.Writer is
// set (caller manages the file), we use it as-is.
if req.Output != "" && req.Output != "-" {
// Resume is meaningful only when we own the output file. If the
// caller already supplied a Writer we cannot append to Output
// behind their back, so disable resume to keep the partial-state
// sidecar consistent with what actually lands on disk.
if req.Resume && req.Writer != nil && req.Verbose {
fmt.Fprintf(os.Stderr, "[gemini] warning: --resume ignored because a Writer is set; output goes to the Writer only\n")
}
if req.Resume && req.Writer != nil {
req.Resume = false
}
if req.Resume {
canResume, resumeMeta, rerr := output.CanResume(req.Output, req.URL.String())
if rerr != nil {