From f113dd28c2389b6f1928cab7159d2acaa65c069c Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Thu, 14 Apr 2022 07:08:58 -0700 Subject: [PATCH] feat(cli): added KOPIA_IGNORE_MALFORMED_MANIFEST_CONTENTS (#1890) This can usually help open corrupted repository and partially restore data. --- repo/manifest/committed_manifest_manager.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/repo/manifest/committed_manifest_manager.go b/repo/manifest/committed_manifest_manager.go index 621481411..8e1e9ee5c 100644 --- a/repo/manifest/committed_manifest_manager.go +++ b/repo/manifest/committed_manifest_manager.go @@ -147,6 +147,14 @@ func (m *committedManifestManager) loadCommittedContentsLocked(ctx context.Conte }, func(ci content.Info) error { man, err := loadManifestContent(ctx, m.b, ci.GetContentID()) if err != nil { + // this can be used to allow corrupterd repositories to still open and see the + // (incomplete) list of manifests. + if os.Getenv("KOPIA_IGNORE_MALFORMED_MANIFEST_CONTENTS") != "" { + log(ctx).Warnf("ignoring malformed manifest content %v: %v", ci.GetContentID(), err) + + return nil + } + return err } mu.Lock()