From 1d25abc922924773091900585296b02bac41098d Mon Sep 17 00:00:00 2001 From: powe97 <116031952+powe97@users.noreply.github.com> Date: Sat, 11 Feb 2023 01:37:55 -0500 Subject: [PATCH] Update search_helper.js --- js/search_helper.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/search_helper.js b/js/search_helper.js index ab18beafc..422265c37 100644 --- a/js/search_helper.js +++ b/js/search_helper.js @@ -26,9 +26,8 @@ const search_helper = function(event) { // if it is, redirect to it if(course_exists) { - const loc = window.location.pathname; // handle both homepage and courses pages - if(loc.substring(0,loc.lastIndexOf('/')) != "/courses") { + if(window.location.pathname.split("/").slice(-2,-1)[0] != "courses") { location.href = "courses/"+code_str; } else { location.href = code_str;