-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
fix: remove invalid character for XML feed; fix #537 #538
base: master
Are you sure you want to change the base?
Conversation
Deploy preview for saber ready! Built with commit 84b29bb |
*/ | ||
exports.removeXMLInvalidChars = (string, removeDiscouragedChars = true) => { | ||
// remove everything forbidden by XML 1.0 specifications, plus the unicode replacement character U+FFFD | ||
var regex = /((?:[\0-\x08\x0B\f\x0E-\x1F\uFFFD\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g |
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.
change var
to let
and disable unicorn/no-hex-escape
and no-control-regex
rules in package.json
you can also do /* eslint-disable no-control-regex */
before this line instead
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.
thanks, let me improve
* @param {string} string - a string potentially containing XML-invalid characters, such as non-UTF8 characters, STX, EOX and so on. | ||
* @param {boolean} removeDiscouragedChars - a string potentially containing XML-invalid characters, such as non-UTF8 characters, STX, EOX and so on. | ||
* @return : a sanitized string without all the XML-invalid characters. | ||
*/ |
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.
Can you add a reference to those RegExp?
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.
updated
I opened an issue to see if it's possible to be fixed by the upstream jpmonette/feed#107 |
Summary
What kind of change does this PR introduce? (check at least one)
If changing the UI/CSS related code, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
close #537