-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Incorrect quotes in translate helper causes 500 error #15500
Labels
bug
[triage] something behaving unexpectedly
Hacktoberfest
Issues suitable for hacktoberfest participants
help wanted
[triage] Ideal issues for contributors to help with
Comments
github-actions
bot
added
the
needs:triage
[triage] this needs to be triaged by the Ghost team
label
Sep 29, 2022
ErisDS
added
bug
[triage] something behaving unexpectedly
themes / frontend
help wanted
[triage] Ideal issues for contributors to help with
Hacktoberfest
Issues suitable for hacktoberfest participants
labels
Sep 29, 2022
github-actions
bot
removed
the
needs:triage
[triage] this needs to be triaged by the Ghost team
label
Sep 29, 2022
I would like to work on this. Can you assign this to me? |
@shivamchourasia4 we only assign issues to regular contributors. There is no open PR for this issue so it's free to work on. |
This looks good on 5.17.x However, I just realized this ticket called out 4.x as the affected version. So I'll revisit this when I checkout 4.x. |
cweave
added a commit
to cweave/Ghost
that referenced
this issue
Oct 5, 2022
closes TryGhost#15500 Per the issue, Ghost has a policy to never throw 500 Internal Server errors for theme issues. This change adds a check inside of `ghost\core\core\frontend\helpers\t.js` if `text` or `options` is undefined, to throw an `IncorrectUsageError` error within the function. Messaging was borrowed from `ghost\core\core\frontend\web\middleware\error-handler.js`.
3 tasks
cweave
added a commit
to cweave/Ghost
that referenced
this issue
Oct 13, 2022
Added unit tests to the MR TryGhost#15529 / issue TryGhost#15500. Added a regex in the `t()` to explicitly check for smart apostrophes in the event that they are not stripped out/come through as undefined.
3 tasks
sam-lord
pushed a commit
that referenced
this issue
Oct 17, 2022
closes: #15500 - Per the issue, Ghost has a policy to never throw 500 Internal Server errors for theme issues. This change adds a check inside of `ghost\core\core\frontend\helpers\t.js` if `text` or `options` is undefined, to throw an `IncorrectUsageError` error within the function. - Messaging was borrowed from `ghost\core\core\frontend\web\middleware\error-handler.js`.
sagzy
added a commit
that referenced
this issue
Jul 25, 2024
…20663) ref https://linear.app/tryghost/issue/SLO-182 ref #15500 - when the {{ t }} helper is used with no parameter or an empty string, it now returns an empty string - when the {{ t }} helper is used without options, it now does not throw an error
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
[triage] something behaving unexpectedly
Hacktoberfest
Issues suitable for hacktoberfest participants
help wanted
[triage] Ideal issues for contributors to help with
Issue Summary
Using smart quotes in the translate helper causes page visits to throw 500 errors. Mac OS for example will auto-convert quotes by default, and this a common and VERY hard to spot issue for people new to code.
Smart quotes example:
{{t “This causes an error”}}
Straight quotes example:
{{t "This causes an error"}}
As handlebars would always expect straight quotes, I suspect this is true for several helpers.
Although the fact that this is an error is correct, we have a policy of never throwing 500 Internal Server errors for theme issues, but instead throw 400 Bad Request errors.
This is slightly odd, but nothing is wrong with the server, it's doing everything correctly and therefore this is not an error that the person running Ghost needs to deal with, but rather the user who uploaded the theme.
In this case, the error can probably be handled better.
Steps to Reproduce
{{t “This causes an error”}}
Ghost Version
4.42.1
Node.js Version
16.14.2
How did you install Ghost?
ghost install
Database type
MySQL 8
Browser & OS version
Any
Relevant log / error output
The text was updated successfully, but these errors were encountered: