Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

fix: prevent infinite loop with locale#2179

Merged
bcoe merged 2 commits intoyargs:mainfromjly36963:fix-locale-infinite-loop
May 15, 2022
Merged

fix: prevent infinite loop with locale#2179

bcoe merged 2 commits intoyargs:mainfromjly36963:fix-locale-infinite-loop
May 15, 2022

Conversation

jly36963
Copy link
Contributor

Addresses:#2178

Description

locale and kGuessLocale can enter an infinite loop

Details

There's regex logic that turns '.UTF-8' into '', and downstream there is logic checking if that value is falsey (instead of undefined).

As a result, kGuessLocale and locale call each other infinitely.

Todo

this.locale(locale.replace(/[.:].*/,''))

This line is what converts'.UTF-8' into''. I don't know if my fix is sufficient or if the real problem is here.

@@ -871,7 +871,7 @@ export class YargsInstance {
}
locale(locale?: string): YargsInstance | string {
argsert('[string]', [locale], arguments.length);
if (!locale) {
if (locale === undefined) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

'' is falsey, and it causes the two functions to infinitely call each other

@jly36963jly36963 requested a review frombcoeMay 7, 2022 15:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bcoebcoebcoe approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@jly36963@bcoe

[8]ページ先頭

©2009-2025 Movatter.jp