Skip to content

Commit 6693a5d

Browse files
committed
if CAR is so bad we can't go on, fail out
1 parent 991d2f9 commit 6693a5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/relay/bgs/validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (val *Validator) VerifyCommitMessage(ctx context.Context, host *models.PDS,
192192
commit, repoFragment, err := atrepo.LoadFromCAR(ctx, bytes.NewReader([]byte(msg.Blocks)))
193193
if err != nil {
194194
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
195-
if !val.Sync11ErrorsAreWarnings {
195+
if !val.Sync11ErrorsAreWarnings || commit == nil || repoFragment == nil {
196196
return nil, err
197197
} else {
198198
logger.Warn("invalid car", "err", err)
@@ -409,7 +409,7 @@ func (val *Validator) HandleSync(ctx context.Context, host *models.PDS, msg *atp
409409
commit, err := atrepo.LoadCARCommit(ctx, bytes.NewReader([]byte(msg.Blocks)))
410410
if err != nil {
411411
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
412-
if !val.Sync11ErrorsAreWarnings {
412+
if !val.Sync11ErrorsAreWarnings || commit == nil {
413413
return nil, err
414414
} else {
415415
logger.Warn("invalid car", "err", err)

0 commit comments

Comments
 (0)