-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix auto import path mapping when first pattern fails #54868
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
Conversation
@@ -775,7 +775,9 @@ | |||
validateEnding({ ending, value }) | |||
) { | |||
const matchedStar = value.substring(prefix.length, value.length - suffix.length); | |||
return pathIsRelative(matchedStar) ? undefined : key.replace("*", matchedStar); | |||
if (!pathIsRelative(matchedStar)) { | |||
return key.replace("*", matchedStar); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=(
Edit: Is there an unambiguous way to replace only once so codeql won't complain? Probably not, that would be too easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you can use a global regex, but I don’t want to allocate an object when a string literal will do.
@@ -775,7 +775,9 @@ | |||
validateEnding({ ending, value }) | |||
) { | |||
const matchedStar = value.substring(prefix.length, value.length - suffix.length); | |||
return pathIsRelative(matchedStar) ? undefined : key.replace("*", matchedStar); | |||
if (!pathIsRelative(matchedStar)) { | |||
return key.replace("*", matchedStar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=(
Edit: Is there an unambiguous way to replace only once so codeql won't complain? Probably not, that would be too easy.
Fixes #54324