mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-01 21:36:25 -06:00
#7162: Don't modify the original API URL when prepending BASE_PATH
This commit is contained in:
parent
70cd0969e4
commit
c35563d82f
BIN
netbox/project-static/dist/config.js
vendored
BIN
netbox/project-static/dist/config.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/config.js.map
vendored
BIN
netbox/project-static/dist/config.js.map
vendored
Binary file not shown.
BIN
netbox/project-static/dist/jobs.js
vendored
BIN
netbox/project-static/dist/jobs.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/jobs.js.map
vendored
BIN
netbox/project-static/dist/jobs.js.map
vendored
Binary file not shown.
BIN
netbox/project-static/dist/lldp.js
vendored
BIN
netbox/project-static/dist/lldp.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/lldp.js.map
vendored
BIN
netbox/project-static/dist/lldp.js.map
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
BIN
netbox/project-static/dist/status.js
vendored
BIN
netbox/project-static/dist/status.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/status.js.map
vendored
BIN
netbox/project-static/dist/status.js.map
vendored
Binary file not shown.
@ -163,17 +163,21 @@ function buildUrl(destination: string): string {
|
||||
|
||||
// If the `origin` exists in the API path (as in the case of paginated responses), remove it.
|
||||
const origin = new RegExp(window.location.origin, 'g');
|
||||
let path = pathname.replaceAll(origin, '');
|
||||
let path = pathname
|
||||
.replaceAll(origin, '')
|
||||
.split('/')
|
||||
.filter(p => p);
|
||||
|
||||
const basePath = getBasePath();
|
||||
|
||||
// If the `BASE_PATH` already exists in the URL, remove it.
|
||||
if (basePath !== '' && path.includes(basePath)) {
|
||||
path = path.replaceAll(basePath, '');
|
||||
// If the `BASE_PATH` already exists in the URL, and it is the first element, remove it.
|
||||
if (basePath !== '' && path[0].includes(basePath)) {
|
||||
const [_, ...appPath] = path;
|
||||
path = ['', ...appPath];
|
||||
}
|
||||
|
||||
// Combine `BASE_PATH` with this request's path, removing _all_ slashes.
|
||||
let combined = [...basePath.split('/'), ...path.split('/')].filter(p => p);
|
||||
let combined = [...basePath.split('/'), ...path].filter(p => p);
|
||||
|
||||
if (combined[0] !== '/') {
|
||||
// Ensure the URL has a leading slash.
|
||||
|
Loading…
Reference in New Issue
Block a user