Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
YuSerin opened this issue Jan 25, 2024 · 1 comment
Closed

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

YuSerin opened this issue Jan 25, 2024 · 1 comment

Comments

@YuSerin
Copy link

YuSerin commented Jan 25, 2024

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

copybara-service bot pushed a commit that referenced this issue Feb 6, 2024
Relax the regex to only check for hyphen which is required by the specification.

Issue: #1028
#minor-release
PiperOrigin-RevId: 604719300
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Feb 6, 2024
Relax the regex to only check for hyphen which is required by the specification.

Issue: androidx/media#1028
#minor-release
PiperOrigin-RevId: 604719300
SheenaChhabra pushed a commit that referenced this issue Feb 9, 2024
Relax the regex to only check for hyphen which is required by the specification.

Issue: #1028
#minor-release
PiperOrigin-RevId: 604719300
(cherry picked from commit 138532e)
@rohitjoins
Copy link
Contributor

Hi @YuSerin,

Thanks for reporting the issue. A fix was released for this.

@androidx androidx locked and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants