Skip to content
Snippets Groups Projects
Commit 84802970 authored by Demian Katz's avatar Demian Katz Committed by Robert Lange
Browse files

Fix URL root determination bug (VUFIND-1378).

parent c02ca818
Branches
Tags
No related merge requests found
......@@ -163,13 +163,16 @@ function getUrlRoot(url) {
var urlroot = null;
var urlParts = url.split(/[?#]/);
var urlWithoutFragment = urlParts[0];
var slashSlash = urlWithoutFragment.indexOf('//');
if (VuFind.path === '' || VuFind.path === '/') {
// special case -- VuFind installed at site root:
var chunks = urlWithoutFragment.split('/');
urlroot = '/' + chunks[1] + '/' + chunks[2];
// We need to extract different offsets if this is a full vs. relative URL:
urlroot = slashSlash > -1
? ('/' + chunks[3] + '/' + chunks[4])
: ('/' + chunks[1] + '/' + chunks[2]);
} else {
// standard case -- VuFind has its own path under site:
var slashSlash = urlWithoutFragment.indexOf('//');
var pathInUrl = slashSlash > -1
? urlWithoutFragment.indexOf(VuFind.path, slashSlash + 2)
: urlWithoutFragment.indexOf(VuFind.path);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment