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

Fixed incorrect input pattern in the app #20263

Merged
merged 2 commits into from
Oct 31, 2023
Merged

Fixed incorrect input pattern in the app #20263

merged 2 commits into from
Oct 31, 2023

Conversation

br41nslug
Copy link
Member

Fixes #20262

Scope

What's changed:

The old regex had [+-]? which is invalid as the minus inside the square brackets is a reserved character to do character ranges like [a-z] however it is missing its right hand range argument.
Solution is to escape the minus character.

@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2023

🦋 Changeset detected

Latest commit: 01f2890

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@directus/app Patch
@directus/api Patch
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@br41nslug br41nslug changed the title Fixed incorrect regex in the app Fixed incorrect input pattern in the app Oct 31, 2023
@azrikahar
Copy link
Contributor

Nice one! Did a quick search out of curiosity, I assume we'll need to fix it over here as well?

if (!/[+-]?([0-9]+[.])?[0-9]+/.test(input)) return input;

(could be a separate PR of course)

@br41nslug
Copy link
Member Author

Nice one! Did a quick search out of curiosity, I assume we'll need to fix it over here as well?

if (!/[+-]?([0-9]+[.])?[0-9]+/.test(input)) return input;

(could be a separate PR of course)

Interesting good catch, i was only searching through the app

@br41nslug
Copy link
Member Author

Lets deal with that specific case in a separate PR instead, did some quick tests and nodejs does not error on this specific situation but i think the Regex is still incorrect. It is supposed to match bigInt but also matches strings like '+123blah' because it has no end-of-string or start-of-string match.

@azrikahar azrikahar merged commit 2273dbc into main Oct 31, 2023
6 checks passed
@azrikahar azrikahar deleted the fix-20262 branch October 31, 2023 13:08
@github-actions github-actions bot added this to the Next Patch Release milestone Oct 31, 2023
br-rafaelbarros pushed a commit to personal-forks/directus-source that referenced this pull request Nov 7, 2023
* fixed incorrect regex

* Create strange-vans-watch.md
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect regex in input pattern
2 participants