From 145683b6e62ef21bebef51232ae6fa9c431ee3e2 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Thu, 16 Jan 2020 15:25:02 -0500
Subject: [PATCH] Fix channels bug when VuFind configured at site root. (#1541)

- Resolves VUFIND-1377.
---
 themes/bootstrap3/js/common.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js
index 40e10735741..a0b93c1628f 100644
--- a/themes/bootstrap3/js/common.js
+++ b/themes/bootstrap3/js/common.js
@@ -163,10 +163,10 @@ function getUrlRoot(url) {
   var urlroot = null;
   var urlParts = url.split(/[?#]/);
   var urlWithoutFragment = urlParts[0];
-  if (VuFind.path === '') {
+  if (VuFind.path === '' || VuFind.path === '/') {
     // special case -- VuFind installed at site root:
     var chunks = urlWithoutFragment.split('/');
-    urlroot = '/' + chunks[3] + '/' + chunks[4];
+    urlroot = '/' + chunks[1] + '/' + chunks[2];
   } else {
     // standard case -- VuFind has its own path under site:
     var slashSlash = urlWithoutFragment.indexOf('//');
-- 
GitLab