Skip to content

deleteSectionById() clears the GPP string when deleting a section that is not present #99

Description

@shantanu-kamdi

Summary

Calling deleteSectionById(2) on a model initialized with a GPP string that only contains usco incorrectly clears the model and re-encodes to DBAA.

Steps to Reproduce

Initialize the model with DBABJg~BVUAAJg.QA
Call deleteSectionById(2)
Read the encoded GPP string again

const cmpApi = new CmpApi(123, 1);
cmpApi.setGppString("DBABJg~BVUAAJg.QA");

console.log("before:", cmpApi.getGppString());

cmpApi.deleteSectionById(2);

console.log("after:", cmpApi.getGppString());

Observer

before: DBABJg~BVUAAJg.QA
after: DBAA

Expected

The string should remain unchanged because section id 2 is not present.

Package Version
@iabgpp/cmpapi@3.1.9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions