Skip to content

Commit

Permalink
fix: Handle exception while building version comment (#12801)
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 committed Apr 5, 2021
1 parent 84e1964 commit 13e7f45
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,23 @@ function get_version_comment(version_doc, text) {
let version_comment = "";
let unlinked_content = "";

Array.from($(text)).forEach(element => {
if ($(element).is('a')) {
version_comment += unlinked_content ? frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content) : "";
unlinked_content = "";
version_comment += element.outerHTML;
} else {
unlinked_content += element.outerHTML || element.textContent;
try {
Array.from($(text)).forEach(element => {
if ($(element).is('a')) {
version_comment += unlinked_content ? frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content) : "";
unlinked_content = "";
version_comment += element.outerHTML;
} else {
unlinked_content += element.outerHTML || element.textContent;
}
});
if (unlinked_content) {
version_comment += frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content);
}
});
if (unlinked_content) {
version_comment += frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content);
return version_comment;
} catch (e) {
// pass
}
return version_comment;
}
return frappe.utils.get_form_link('Version', version_doc.name, true, text);
}
Expand Down

0 comments on commit 13e7f45

Please sign in to comment.