From 43cd78ba7dca206e41e437fd7fec259ea7752e15 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Mon, 13 Apr 2020 13:01:54 +0530 Subject: [PATCH] chore: codacy fixes Signed-off-by: Chinmay D. Pai --- frappe/public/js/frappe/utils/common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/utils/common.js b/frappe/public/js/frappe/utils/common.js index 9b1e71b2ca..74e1d13e0e 100644 --- a/frappe/public/js/frappe/utils/common.js +++ b/frappe/public/js/frappe/utils/common.js @@ -264,14 +264,14 @@ frappe.utils.sanitise_redirect = (url) => { const is_external = (() => { return (url) => { function domain(url) { - let base_domain = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img.exec(url); + let base_domain = /^(?:https?://)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img.exec(url); return base_domain == null ? "" : base_domain[1]; } function is_absolute(url) { // returns true for url that have a defined scheme // anything else, eg. internal urls return false - return /^(?:[a-z]+:)?\/\//i.test(url) + return /^(?:[a-z]+:)?\/\//i.test(url); } // check for base domain only if the url is absolute @@ -287,7 +287,7 @@ frappe.utils.sanitise_redirect = (url) => { return url.replace(REGEX_SCRIPT, ""); }); - url = strip_url(url); + url = frappe.utils.strip_url(url); return is_external(url) ? "" : sanitise_javascript(frappe.utils.xss_sanitise(url, {strategies: ["js"]})); }