fix: getBaseUrl() returns correct module prefix for /dashboard_for_sage path

This commit is contained in:
yumoqing 2026-05-24 15:41:57 +08:00
parent 1a3412176d
commit b83131146a

View File

@ -9,9 +9,9 @@
// Derive base URL from current page (e.g. /dashboard_for_sage/index.ui -> /dashboard_for_sage)
function getBaseUrl() {
var path = window.location.pathname;
// Remove .ui or .dspy extension
var idx = path.lastIndexOf('/');
return path.substring(0, idx);
// path is like /dashboard_for_sage/index.ui or /dashboard_for_sage
var parts = path.split('/').filter(function(p) { return p; });
return '/' + parts[0];
}
function buildUrl(dspyFile) {