-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 HTML entities not decoded in comment just added #35054
Fix HTML entities not decoded in comment just added #35054
Conversation
/backport to stable25 |
/backport to stable24 |
/backport to stable23 |
/compile / |
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.
Other than the named export suggestion :)
This will make possible to use it from files other than "GetComments.js". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The XML data received from the comments endpoint has an inconsistent encoding; some entities are encoded once and others are encoded twice. When the comment list is loaded the comments are fetched using GetComments, which handles all that, and therefore shows the messages and author names as expected. However, when a new comment is posted the list is not got again; instead the new comment is loaded from the comment data returned after posting it. This is done in NewComment, which did not decode the messages nor the author names, and therefore showed, for example, "&" instead of "&". To solve that now the same decoding logic used in GetComments is applied too in NewComment. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1b70a7e
to
4fe5b9a
Compare
/compile amend / |
Done :-) |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
4fe5b9a
to
99b1d00
Compare
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.
🐘
/backport to stable24 |
/backport to stable23 |
The backport to stable23 failed. Please do this backport manually. |
Follow up to #29029
The XML data received from the comments endpoint has an inconsistent encoding; some entities are encoded once and others are encoded twice. When the comment list is loaded the comments are fetched using
GetComments
, which handles all that, and therefore shows the messages and author names as expected.However, when a new comment is posted the list is not got again; instead the new comment is loaded from the comment data returned after posting it. This is done in
NewComment
, which did not decode the messages nor the author names, and therefore showed, for example,&
instead of&
.To solve that now the same decoding logic used in
GetComments
is applied too inNewComment
.@Pytal I extracted decodeHtmlEntities to its own file and I assigned the copyright of that file to you, as you added the original function. I hope that is fine :-)
How to test
John "The Hangman" Ruth
< & >
Result with this pull request
The text of the comment just added is
< & >
, and it was sent byJohn "The Hangman" Ruth
Result without this pull request
The text of the comment just added is
&lt; & &gt;
, and it was sent byJohn "The Hangman" Ruth
; if the page is reloaded and the Comments tab is shown again now the message has the expected author and text