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

SF V2 - some HTML entities being incorrectly escaped during push #2448

Closed
rhobkirkcertinia opened this issue Sep 5, 2023 · 12 comments
Closed
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@rhobkirkcertinia
Copy link

Summary

In our customlabels we have some HTML entities that get pushed up to the org.

These are things like < , > and   etc. All of these seem to work except   which gets encoded when pushing to the org and ends up rendering as the literal character code when used.

  is a non-breaking space and is the same as using  . We've tried switching over to that and it also got encoded and therefore didn’t work either. This appears to be a regression as SFDX cli version 7.183.1 doesn’t have this issue.

This issue might exist with other characters too - this is the only one that we've spotted so far.

Steps To Reproduce

  1. Create a label similar to this
    <labels>
        <fullName>example</fullName>
        <categories>example</categories>
        <language>en_US</language>
        <protected>true</protected>
        <shortDescription>example.</shortDescription>
        <value>3 results,&#160;and 1 other.</value>
    </labels>
    
  2. Import that label into an LWC and render it out on the HTML and add it to a page.
  3. Deploy that code to an org using SFDX 7.183.1
  4. View the component in an org and view the LWC and it should show the label as 3 results, and 1 other
  5. Change to SF version 2.5.8
  6. Deploy the same code to the org again (or a new org)
  7. Now it displays as 3 results,&#160;and 1 other

Expected result

HTML entities are not escaped so that they are rendered as expected (and per previous CLI behaviour)

Actual result

HTML entities are escaped, causing them to be rendered as the string literal version of the character

System Information

@salesforce/cli/2.5.8 darwin-arm64 node-v18.15.0

@rhobkirkcertinia rhobkirkcertinia added the investigating We're actively investigating this issue label Sep 5, 2023
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Hello @rhobkirkcertinia 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Sep 5, 2023
@mshanemc mshanemc added the bug Issue or pull request that identifies or fixes a bug label Sep 6, 2023
@git2gus
Copy link

git2gus bot commented Sep 6, 2023

This issue has been linked to a new work item: W-14079220

@mshanemc mshanemc removed the more information required Issue requires more information or a response from the customer label Sep 6, 2023
@mshanemc
Copy link
Contributor

mshanemc commented Sep 6, 2023

found it, got a fix PR ready.

@rhobkirkcertinia
Copy link
Author

Brilliant, thanks @mshanemc!

@mshanemc
Copy link
Contributor

mshanemc commented Sep 8, 2023

@rhobkirkcertinia can you try this with your codebase using nightly for sf to make sure this solved all of them.

@mshanemc
Copy link
Contributor

welp, that turned out really bad (caused a regression with the parsing of some other html entities). #2455

gonna roll that back and come up with some other opton.

@rhobkirkcertinia
Copy link
Author

Ouch, thanks for trying @mshanemc . I'll hang fire testing until there is a new solution - please can you re-open this issue in the mean time?

@mshanemc
Copy link
Contributor

this issue stayed open, only the PR associated was closed

@mshanemc
Copy link
Contributor

mshanemc commented Oct 3, 2023

OK, after a much better investigation than the first time, here's what I've found.

sfdx < 7.184

Local project value>3 results,&#160;and 1 other.</value>
CLI would deploy labels with html markup "as is"
CustomLabel in the CustomLabels UI would show the "interpreted" value 3 results, and 1 other. but if you inspect there (or in an LWC) you'd see the html characters from the label.
If you retrieve from the org, you'd get <value>3 results, and 1 other.</value> into the local project. This happens even in mdapi format--the special characters are lost and converted to a "regular space"

since then (sfdx >= 7.184 and sf >=2 )

CLI was escaping the ampersand character & so that value>3 results,&#160;and 1 other.</value> would deploy,
Showed up in CustomLabels UI and LWC as 3 results,&#160;and 1 other.
retrieve as value>3 results,&amp;#160;and 1 other.</value> which is how it was showing up in the LWC.

I think I can fix that safely. It'll still clobber labels down to a (space) when you retrieve it.

@rhobkirkcertinia
Copy link
Author

Thanks @mshanemc 👍

@iowillhoit
Copy link
Contributor

Fixed in the latest version of sf 2.12.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants