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

Seemingly valid peer ids rejected by validateId function #849

Open
LostBeard opened this issue May 19, 2021 · 1 comment
Open

Seemingly valid peer ids rejected by validateId function #849

LostBeard opened this issue May 19, 2021 · 1 comment
Labels
bug client related to peerjs client confirmed acknowledged as an issue help wanted looking for contributors

Comments

@LostBeard
Copy link

LostBeard commented May 19, 2021

The API documentation states:
The ID must start and end with an alphanumeric character (lower or upper case character or a digit). In the middle of the ID spaces, dashes (-) and underscores (_) are allowed.

Problem:
According to the documentation the below ids should be valid but instead throw the error "invalid-id". The docs fail to mention that spaces, dashes, and underscores cannot be next to each other.
acb123_-xyz
acb123__xyz
acb123--xyz
acb123 -xyz

Solution:
If there is no functional reason for this limitation the validateId function regex could be updated to reflect the documentation. Alternatively the documentation could be amended.

The regex that validate the peer id is currently:
^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$

Updated regex to match documentation:
^[A-Za-z0-9][A-Za-z0-9_- ]*[A-Za-z0-9]$

@afrokick
Copy link
Member

Maybe we should remove at all this limits. Thanks!

@afrokick afrokick added bug confirmed acknowledged as an issue help wanted looking for contributors labels Feb 20, 2022
@irgalamarr irgalamarr added the client related to peerjs client label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug client related to peerjs client confirmed acknowledged as an issue help wanted looking for contributors
Projects
None yet
Development

No branches or pull requests

3 participants