diff --git a/src/restic/checker/checker.go b/src/restic/checker/checker.go index 4b147d442..b4b7d3f0f 100644 --- a/src/restic/checker/checker.go +++ b/src/restic/checker/checker.go @@ -534,6 +534,7 @@ func filterTrees(backlog backend.IDs, loaderChan chan<- backend.ID, in <-chan tr inCh = nil case outCh <- job: + debug.Log("checker.FilterTrees", "tree sent to check: %v", job.ID.Str()) outCh = nil inCh = in } @@ -581,6 +582,10 @@ func (c *Checker) checkTree(id backend.ID, tree *restic.Tree) (errs []error) { for _, node := range tree.Nodes { switch node.Type { case "file": + if node.Content == nil { + errs = append(errs, Error{TreeID: id, Err: fmt.Errorf("file %q has nil blob list", node.Name)}) + } + for b, blobID := range node.Content { if blobID.IsNull() { errs = append(errs, Error{TreeID: id, Err: fmt.Errorf("file %q blob %d has null ID", node.Name, b)}) @@ -598,6 +603,13 @@ func (c *Checker) checkTree(id backend.ID, tree *restic.Tree) (errs []error) { errs = append(errs, Error{TreeID: id, Err: fmt.Errorf("dir node %q subtree id is null", node.Name)}) continue } + + default: + errs = append(errs, Error{TreeID: id, Err: fmt.Errorf("node %q with invalid type %q", node.Name, node.Type)}) + } + + if node.Name == "" { + errs = append(errs, Error{TreeID: id, Err: errors.New("node with empty name")}) } }