-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
(dev/core#3436) MultipleRecordFieldsListing.tpl - JS strings should us JS escaping #23499
Conversation
(Standard links)
|
This also simplifies list of strings outputted for the file. Before,
Now it just reports the cleaner string. |
Actually, this may also fix dev/core#3436. I'm not very experienced with Transifex, so I'm not sure how to identify which variants of the strings were at play in the problem-report... but... I tried hacking my system to force/mock some funny characters: diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php
index d1da1fe698..4834f4f0f8 100644
--- a/CRM/Core/I18n.php
+++ b/CRM/Core/I18n.php
@@ -796,6 +796,10 @@ function ts($text, $params = []) {
static $i18n = NULL;
static $function = NULL;
+ if ($text === "No records of type '%1' found." || $text === "No records of type \\'%1\\' found.") {
+ $text = "No records'quote<b>\" e '%1' found."; // Hacky override of translation
+ }
+
if ($text == '') {
return '';
} With this funny translation, I could compare before/after: |
@@ -33,7 +33,7 @@ | |||
{literal} | |||
<script type="text/javascript"> | |||
(function($) { | |||
var ZeroRecordText = {/literal}'{ts 1=$customGroupTitle|escape}No records of type \'%1\' found.{/ts}'{literal}; | |||
var ZeroRecordText = {/literal}"{ts escape='js' 1=$customGroupTitle}No records of type '%1' found.{/ts}"{literal}; |
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.
I think you might as well make it {ts escape='js' 1=$customGroupTitle|smarty:nodefaults}
- since it's a good guess this would break under strict smarty too
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.
@eileenmcnaughton Good idea. I've r-run
with that and force-pushed.
Also, the branch should be amenable to 5.50, so I'll switch it.
As discussed, we should port this to 5.49 & it can go out in any point releases that happen |
Overview
Suppose you make a multi-record custom-data group with a funny name
The good thing is that doesn't execute this. But it does do excessive escaping in one place.
Before
Most widgets+screens showing this name will display characters like
<
as<
. Notice the tab-bar and the button-bar.However, there's an outlier in the middle which displays
<
as<
:After
Like everywhere else, the center of the page displays
<
as<
. (It looks the same as when it was typed.)Comments
Noticed this well reading https://lab.civicrm.org/dev/core/-/issues/3436, though it's a bit tangential to that problem.