Skip to content

Commit

Permalink
Revert "CBG-2973: Fix panic for assigning to nil map inside Mutable1x…
Browse files Browse the repository at this point in the history
…Body (#6252)"

This reverts commit 044bf5b.
  • Loading branch information
torcolvin committed May 22, 2023
1 parent cb6aef7 commit e9d3a62
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions db/revision_cache_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ func (rev *DocumentRevision) Mutable1xBody(db *DatabaseCollectionWithUser, reque
if err != nil {
return nil, err
}
if b == nil {
return nil, base.RedactErrorf("null doc body for docID: %s revID: %s", base.UD(rev.DocID), base.UD(rev.RevID))
}

b[BodyId] = rev.DocID
b[BodyRev] = rev.RevID
Expand Down
13 changes: 0 additions & 13 deletions rest/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2678,19 +2678,6 @@ func TestDocChannelSetPruning(t *testing.T) {
assert.Equal(t, uint64(12), syncData.ChannelSetHistory[0].End)
}

func TestNullDocHandlingForMutable1xBody(t *testing.T) {
rt := NewRestTester(t, nil)
defer rt.Close()
collection := rt.GetSingleTestDatabaseCollectionWithUser()

documentRev := db.DocumentRevision{DocID: "doc1", BodyBytes: []byte("null")}

body, err := documentRev.Mutable1xBody(collection, nil, nil, false)
require.Error(t, err)
require.Nil(t, body)
assert.Contains(t, err.Error(), "null doc body for doc")
}

func TestTombstoneCompactionAPI(t *testing.T) {
rt := NewRestTester(t, nil)
rt.GetDatabase().PurgeInterval = 0
Expand Down

0 comments on commit e9d3a62

Please sign in to comment.