From f1fffcf16c862c801538f3969d4225027a1d31a7 Mon Sep 17 00:00:00 2001 From: mrhid6 Date: Mon, 7 Sep 2026 14:11:58 +0000 Subject: [PATCH] fix: Report the real reason verify falls back to archive-only checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolveGlobals can fail for two distinct reasons — no MongoDB URI, or no resolvable database name — and verify.go was printing a hardcoded no-URI note regardless of which one occurred, misleading an operator whose URI was fine but whose database name could not be resolved. --- internal/cmd/verify.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/cmd/verify.go b/internal/cmd/verify.go index f8e23ae..758947b 100644 --- a/internal/cmd/verify.go +++ b/internal/cmd/verify.go @@ -33,9 +33,9 @@ func newVerifyCmd() *cobra.Command { opt := backup.VerifyOptions{Archive: archive} - // A database is optional here. resolveGlobals fails without a URI, - // so its error is a signal to verify the archive alone rather than - // a reason to stop. + // A database is optional here. resolveGlobals fails without a URI or + // without a resolvable database name, and either error is a signal to + // verify the archive alone rather than a reason to stop. var client *mongo.Client if g, gerr := resolveGlobals(c); gerr == nil { client, err = connect(ctx, g) @@ -47,8 +47,8 @@ func newVerifyCmd() *cobra.Command { opt.Database = g.Database opt.KeyHex = g.KeyHex } else { - fmt.Fprintln(c.ErrOrStderr(), - "note: no MongoDB URI, so this checks the archive and the key only") + fmt.Fprintf(c.ErrOrStderr(), + "note: %v, so this checks the archive and the key only\n", gerr) } rep, err := backup.Verify(ctx, opt)