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

[Backport 5.1] source: fix username input validation #55097

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Closes #54702

I'm still trying to figure out when this started happening or why it started happening. However, according to the error message it looks like there's an invalid character within the character class (usually denoted by the [] brackets)

image

In the given regular expression /^\w(?:\w|[.-](?=\w))*-?$/, the invalid character class is [.-]. Escaping the hyphen character within the character class [.\-] fixes the error.

Test plan

<!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles -->
Spin up a fresh instance of Sourcegraph, entering the username and password shouldn't trigger the error in the console anymore.

CleanShot 2023-07-07 at 12 16 25@2x

Backport 3e7ee5f from #54708

Closes #54702

I'm still trying to figure out when this started happening or why it started happening. However, according to the error message it looks like there's an invalid character within the character class (usually denoted by the [] brackets)

![image](https://github.com/sourcegraph/sourcegraph/assets/25608335/00833274-d919-408a-959a-c46735cb8b4c)

In the given regular expression `/^\w(?:\w|[.-](?=\w))*-?$/`, the invalid character class is [.-]. Escaping the hyphen character within the character class `[.\-]` fixes the error.

## Test plan

<!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles -->
Spin up a fresh instance of Sourcegraph, entering the username and password shouldn't trigger the error in the console anymore.

![CleanShot 2023-07-07 at 12 16 25@2x](https://github.com/sourcegraph/sourcegraph/assets/25608335/f621a1ee-b320-4d92-95f8-7d46a033e6c4)

(cherry picked from commit 3e7ee5f)
@sourcegraph-bot
Copy link
Contributor

📖 Storybook live preview

@BolajiOlajide BolajiOlajide requested a review from a team July 19, 2023 10:23
@BolajiOlajide BolajiOlajide self-assigned this Jul 19, 2023
@BolajiOlajide BolajiOlajide merged commit fe77af2 into 5.1 Jul 19, 2023
11 checks passed
@BolajiOlajide BolajiOlajide deleted the backport-54708-to-5.1 branch July 19, 2023 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants