Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"babel-polyfill": "^6.26.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+https://github.com/Expensify/expensify-common.git#e958a13ea770ad99de56bb029c2c22fa5cf3eced",
"expensify-common": "git+https://github.com/Expensify/expensify-common.git#36d6f232d3b49d844d9226bc74f668b07cfa7f3c",
"fbjs": "^3.0.2",
"html-entities": "^1.3.1",
"htmlparser2": "^7.2.0",
Expand Down
7 changes: 4 additions & 3 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,15 @@ function hasReportNameError(report) {
}

/**
* For comments shorter than 10k chars, convert the comment from MD into HTML because that's how it is stored in the database
* For longer comments, skip parsing, but still escape the text, and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!!
*
* @param {String} text
* @returns {String}
*/
function getParsedComment(text) {
Comment thread
bernhardoj marked this conversation as resolved.
Resolved
const parser = new ExpensiMark();
return text.length < CONST.MAX_MARKUP_LENGTH ? parser.replace(text) : text;
return text.length < CONST.MAX_MARKUP_LENGTH ? parser.replace(text) : _.escape(text);
}

/**
Expand All @@ -882,8 +885,6 @@ function getParsedComment(text) {
* @returns {Object}
*/
function buildOptimisticAddCommentReportAction(text, file) {
// For comments shorter than 10k chars, convert the comment from MD into HTML because that's how it is stored in the database
// For longer comments, skip parsing and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!!
const parser = new ExpensiMark();
const commentText = getParsedComment(text);
const isAttachment = _.isEmpty(text) && file !== undefined;
Expand Down