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

Add usage of DynamiHTML in remix #1114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Oksamies
Copy link
Contributor

No description provided.

Copy link
Contributor Author

Oksamies commented May 27, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment on lines +15 to +17
return unicodeString
.replaceAll(/\\u005C/g, "\\\\")
.replaceAll(/\\u0027/g, `\\`)

Check failure

Code scanning / CodeQL

Double escaping or unescaping High

This replacement may produce '' characters that are double-unescaped
here
.
export function replaceDjangoUnicode(unicodeString: string) {
return unicodeString
.replaceAll(/\\u005C/g, "\\\\")
.replaceAll(/\\u0027/g, `\\`)
Copy link

Choose a reason for hiding this comment

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

The unicode escape sequence \u0027 represents a single quote character ('), but this code incorrectly replaces it with a backslash (\). The replacement string should be ' instead of \\ to maintain the original meaning of the text.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +144 to +146
__html: parsedLoaderOutput.dynamicBodyBeginning.map((dhtml) =>
replaceDjangoUnicode(dhtml)
),
Copy link

Choose a reason for hiding this comment

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

The array of strings needs to be concatenated to avoid unwanted commas in the rendered HTML. Consider updating to:

__html: parsedLoaderOutput.dynamicBodyBeginning.map((dhtml) => replaceDjangoUnicode(dhtml)).join('')

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

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.

1 participant