Skip to content

Commit

Permalink
[editor] Sanitize contents when copying results to the clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanAhlen committed Jul 21, 2023
1 parent 475a606 commit 2415223
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion desktop/core/src/desktop/js/utils/html/html2text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import deXSS from './deXSS';

const html2text = (value: string): string => {
const element = document.createElement('div');
element.innerHTML = value;
const clean = deXSS(value);
element.innerHTML = clean;
return element.innerText.replace(/\u00A0/g, ' ');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ else:
}
result += '</tr>';
});
$('.clipboard-content').html(result);
$('.clipboard-content').html(hueUtils.deXSS(result));
} else {
$('.clipboard-content').html(window.I18n('Error while copying results.'));
}
Expand Down

0 comments on commit 2415223

Please sign in to comment.