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

Commit

Permalink
OC-21992 HTML code for double quotes appear in field history when tex…
Browse files Browse the repository at this point in the history
…t field is updated
  • Loading branch information
theywa committed Jan 9, 2024
1 parent 758195e commit 0629a43
Showing 1 changed file with 15 additions and 1 deletion.
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])
);
}

_getHistoryRow(item, options = {}) {
const types = {
comment: '<span class="icon fa-comment-o"> </span>',
Expand Down

0 comments on commit 0629a43

Please sign in to comment.