Skip to content

[CMCD] - Update Custom key pattern to match what spec allows #1028

Description

@YuSerin

Use case description

Noticed that the CUSTOM_KEY_NAME_PATTERN regex in CmcdData class is not compliant to spec where it states that "Clients
SHOULD use a reverse-DNS syntax when defining their own prefix" when defining custom CMCD keys. Custom key examples of this syntax in spec, such as com.example-myNumericKey=500, causes errors due to it not matching the pattern. I've personally come across ExoPlaybackException: Unexpected runtime error caused by IllegalStateException at validateCustomDataListFormat method when trying to play some content.

Proposed solution

Update in CmcdData class:

private static final Pattern CUSTOM_KEY_NAME_PATTERN =
    Pattern.compile("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9])+(-[A-Za-z0-9]+)$");

Validated that this pattern allows reverse-DNS syntax and hyphen is still required.
Valid examples:

  • com.example-somekey
  • com.example.test-key
  • test-key

Alternatives considered

N/A

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions