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

only accept first 11 chars of video id #951

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

shakyShane
Copy link
Collaborator

@shakyShane shakyShane commented Apr 10, 2024

https://app.asana.com/0/0/1206957893781164/f

TL;DR

Modified validation and sanitization of video IDs in the duck-player module.

What changed?

  1. The validateVideoId function now checks first if the input is a string. If not, it returns null. If the input is a string, the function extracts the first 11 characters, validates them against a regex pattern and returns these characters if they pass the validation.
  2. The function getValidVideoId now potentially returns null instead of false.

How to test?

The testing responsibilities have been accounted for in the duckplayer.spec.js file. A test has been added that checks whether the ID validation correctly accepts only the first 11 characters of a video ID.

Why make this change?

This change was required to improve the validation of video IDs, considering only the necessary characters and properly handling different data types. It also paves the way for more robust error handling by returning null instead of false in certain functions.


@shakyShane
Copy link
Collaborator Author

shakyShane commented Apr 10, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @shakyShane and the rest of your teammates on Graphite Graphite

@shakyShane shakyShane marked this pull request as ready for review April 10, 2024 09:22
@shakyShane shakyShane changed the title allow accept first 11 chars of video id only accept first 11 chars of video id Apr 10, 2024
@shakyShane
Copy link
Collaborator Author

@jonathanKingston I renamed that method.

@jonathanKingston jonathanKingston merged commit 288c8fc into main Apr 11, 2024
4 checks passed
@jonathanKingston jonathanKingston deleted the 04-10-allow_accept_first_11_chars_of_video_id branch April 11, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants