base url support index file
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ let onTimeout;
|
||||
* @property {boolean} [resolveWithXhr] To resolve with `XMLHttpRequest`.
|
||||
*/
|
||||
|
||||
const baseUrl = window.location.origin + window.location.pathname;
|
||||
const baseUrl = Espo.Utils.obtainBaseUrl();
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1442,7 +1442,7 @@ class App {
|
||||
files.push(file);
|
||||
});
|
||||
|
||||
let baseUrl = window.location.origin + window.location.pathname;
|
||||
let baseUrl = Espo.Utils.obtainBaseUrl();
|
||||
let timestamp = this.loader.getCacheTimestamp();
|
||||
|
||||
let promiseList = files.map(file => {
|
||||
|
||||
@@ -99,7 +99,15 @@
|
||||
this._internalModuleMap = {};
|
||||
this._isDeveloperMode = false;
|
||||
|
||||
this._baseUrl = window.location.origin + window.location.pathname;
|
||||
let baseUrl = window.location.origin + window.location.pathname;
|
||||
|
||||
if (baseUrl.slice(-1) !== '/') {
|
||||
baseUrl = window.location.pathname.includes('.') ?
|
||||
baseUrl.slice(0, baseUrl.lastIndexOf('/')) + '/' :
|
||||
baseUrl + '/';
|
||||
}
|
||||
|
||||
this._baseUrl = baseUrl;
|
||||
|
||||
this._isDeveloperModeIsSet = false;
|
||||
this._basePathIsSet = false;
|
||||
|
||||
@@ -662,6 +662,23 @@ Espo.Utils = {
|
||||
generateId: function () {
|
||||
return (Math.floor(Math.random() * 10000001)).toString()
|
||||
},
|
||||
|
||||
/**
|
||||
* Not to be used in custom code. Can be removed in future versions.
|
||||
* @internal
|
||||
* @return {string}
|
||||
*/
|
||||
obtainBaseUrl: function () {
|
||||
let baseUrl = window.location.origin + window.location.pathname;
|
||||
|
||||
if (baseUrl.slice(-1) !== '/') {
|
||||
baseUrl = window.location.pathname.includes('.') ?
|
||||
baseUrl.slice(0, baseUrl.lastIndexOf('/')) + '/' :
|
||||
baseUrl + '/';
|
||||
}
|
||||
|
||||
return baseUrl;
|
||||
}
|
||||
};
|
||||
|
||||
const keyMap = {
|
||||
|
||||
Reference in New Issue
Block a user