Skip to content

Commit

Permalink
report output html: escape &, <, > from the source C-files to HTML-ou…
Browse files Browse the repository at this point in the history
…tput.

Close Ericsson#3748
  • Loading branch information
dilyanpalauzov committed Oct 15, 2022
1 parent 96db6ec commit c40a25a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
# -------------------------------------------------------------------------

import html
import io
import json
import logging
Expand Down Expand Up @@ -171,7 +172,7 @@ def _add_source_file(self, file: File) -> FileSource:
file_content = InvalidFileContentMsg

self.files[file.id] = {
'id': file.id, 'filePath': file.path, 'content': file_content}
'id': file.id, 'filePath': file.path, 'content': html.escape(file_content)}

return self.files[file.id]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ var BugViewer = {

this._sourceFileData = file;
this._filepath.innerHTML = file.filePath;
this._codeMirror.doc.setValue(file.content);
let e = document.createElement('div');
e.innerHTML = file.content;
this._codeMirror.doc.setValue(e.innerText);
this._refresh();
},

Expand Down

0 comments on commit c40a25a

Please sign in to comment.