Update search_helper.js

This commit is contained in:
powe97 2023-02-11 01:37:55 -05:00 committed by GitHub
parent c84ba3d7b2
commit 1d25abc922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -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;