fix: encode docname when routing (backport #17092) (#17374)

(cherry picked from commit c8777c59cf665ab54218cd7bf9accd1d8e22ddf9)

Co-authored-by: phot0n <ritwikpuri5678@gmail.com>
This commit is contained in:
mergify[bot] 2022-09-07 21:25:51 +05:30 committed by GitHub
parent a35880a089
commit eb4c4fb7b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 10 deletions

View file

@ -52,6 +52,6 @@ context("Table MultiSelect", () => {
"existing_value"
);
cy.get("@existing_value").find(".btn-link-to-form").click();
cy.location("pathname").should("contain", "/user/test@erpnext.com");
cy.location("pathname").should("contain", "/user/test%40erpnext.com");
});
});

View file

@ -894,11 +894,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
return this.settings.get_form_link(doc);
}
const docname = cstr(doc.name).match(/[%'"#\s]/) ? encodeURIComponent(doc.name) : doc.name;
return `/app/${frappe.router.slug(
frappe.router.doctype_layout || this.doctype
)}/${docname}`;
)}/${encodeURIComponent(cstr(doc.name))}`;
}
get_seen_class(doc) {

View file

@ -369,12 +369,7 @@ frappe.router = {
frappe.route_options = a;
return null;
} else {
a = String(a);
if (a && a.match(/[%'"#\s\t]/)) {
// if special chars, then encode
a = encodeURIComponent(a);
}
return a;
return encodeURIComponent(String(a));
}
}).join("/");
let private_home = frappe.workspaces[`home-${frappe.user.name.toLowerCase()}`];