Skip to content

Commit

Permalink
fix: encode docname when routing (backport #17092) (#17374) (#18748)
Browse files Browse the repository at this point in the history
(cherry picked from commit c8777c5)

Co-authored-by: phot0n <ritwikpuri5678@gmail.com>
(cherry picked from commit eb4c4fb)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mergify[bot] committed Nov 3, 2022
1 parent 459fdc2 commit 9fbccc7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/table_multiselect.js
Expand Up @@ -54,6 +54,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");
});
});
4 changes: 1 addition & 3 deletions frappe/public/js/frappe/list/list_view.js
Expand Up @@ -938,11 +938,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) {
Expand Down
7 changes: 1 addition & 6 deletions frappe/public/js/frappe/router.js
Expand Up @@ -430,12 +430,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()}`];
Expand Down

0 comments on commit 9fbccc7

Please sign in to comment.