Strip query params when resolving subpath

This commit is contained in:
Timshel 2024-08-08 13:24:20 +02:00
parent c7b1985ad2
commit 63a24d5e76

View file

@ -577,11 +577,11 @@ index c2eb37eea5..2b5ac93392 100644
+ //
+ // - `https://vaultwarden.example.com/base/path/`
+ // - `https://vaultwarden.example.com/base/path/#/some/route[?queryParam=...]`
+ // - `https://vaultwarden.example.com/base/path/?queryParam=...`
+ //
+ // We want to get to just `https://vaultwarden.example.com/base/path`.
+ let baseUrl = this.win.location.href;
+ baseUrl = baseUrl.replace(/#.*/, ""); // Strip off `#` and everything after.
+ baseUrl = baseUrl.replace(/\/+$/, ""); // Trim any trailing `/` chars.
+ baseUrl = baseUrl.replace(/(\/+|\/*#.*|\/*\?.*)$/, ""); // Strip off trailing `/`, `#`, `?` and everything after.
+ const urls = { base: baseUrl };
// Find the region