Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

OC-21992 HTML code for double quotes appear in field history when text field is updated #732

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion widget/discrepancy-note/dn-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class Comment extends Widget {
: t('widget.dn.fileremoved');
}

this._addAudit(comment, '', false);
this._addAudit(this._decodeHtml(comment), '', false);

if (settings.reasonForChange && !this.linkedQuestionReadonly) {
const reasonQuestion = reasons.addField(this.linkedQuestion);
Expand Down Expand Up @@ -1599,6 +1599,20 @@ class Comment extends Widget {
);
}

_decodeHtml(str) {
return str.replace(
/(&)|(<)|(>)|(')|(")/g,
(tag) =>
({
'&': '&',
'&lt;': '<',
'&gt;': '>',
'&#39;': "'",
'&quot;': '"',
}[tag])
);
}

MartijnR marked this conversation as resolved.
Show resolved Hide resolved
_getHistoryRow(item, options = {}) {
const types = {
comment: '<span class="icon fa-comment-o"> </span>',
Expand Down
Loading