Skip to content

Commit

Permalink
fix(ecommerce): remove query parameters from referrer (backport frapp…
Browse files Browse the repository at this point in the history
…e#33269) (frappe#33513)

fix(ecommerce): remove query parameters from referer

inclusion of query parameters results in logic failure

example:
- logic check if referrer is `all-products`
- `http://shop.example/all-products` -> `all-products`, valid outcome
- `http://shop.example/all-products?start=1` -> `all-products?start=1`,
  invalid outcome

Signed-off-by: Sabu Siyad <hello@ssiyad.com>
(cherry picked from commit b6bd408)

Co-authored-by: Sabu Siyad <hello@ssiyad.com>
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
3 people committed Jan 3, 2023
1 parent 3c83ec5 commit 6516e80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erpnext/setup/doctype/item_group/item_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_parent_item_groups(item_group_name, from_item=False):

if from_item and frappe.request.environ.get("HTTP_REFERER"):
# base page after 'Home' will vary on Item page
last_page = frappe.request.environ["HTTP_REFERER"].split("/")[-1]
last_page = frappe.request.environ["HTTP_REFERER"].split("/")[-1].split("?")[0]
if last_page and last_page in ("shop-by-category", "all-products"):
base_nav_page_title = " ".join(last_page.split("-")).title()
base_nav_page = {"name": _(base_nav_page_title), "route": "/" + last_page}
Expand Down

0 comments on commit 6516e80

Please sign in to comment.