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

Should warn unknown if named format is not closed #435

Merged
merged 1 commit into from
Oct 12, 2018

Conversation

exoego
Copy link
Collaborator

@exoego exoego commented Oct 11, 2018

Closes #434

I believe that: if {named_format is NOT closed (missing }) , the below while loops infintely and bloat the string variable sub, thus causes memory allocation error.

vue-i18n/src/format.js

Lines 48 to 51 in 94583e5

while (char !== '}') {
sub += char
char = format[position++]
}

Personally, I prefer error to be thrown, so that one can notice the invalid named format while development.
But I follow the current design: logging warn rather than throwing error.

@codecov-io
Copy link

codecov-io commented Oct 11, 2018

Codecov Report

Merging #435 into dev will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #435      +/-   ##
==========================================
+ Coverage   95.91%   95.91%   +<.01%     
==========================================
  Files           9        9              
  Lines         636      637       +1     
==========================================
+ Hits          610      611       +1     
  Misses         26       26
Impacted Files Coverage Δ
src/format.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94583e5...2518f76. Read the comment docs.

Copy link
Owner

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Good job! 👍
Thanks!

@kazupon kazupon merged commit d1f6ed0 into kazupon:dev Oct 12, 2018
@exoego exoego deleted the unclosed-named-format branch October 13, 2018 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclosed reference like '{name' in message hangs browsers
3 participants