Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip query params when resolving subpath #170

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions patches/v2024.5.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,13 @@ 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.
BlackDex marked this conversation as resolved.
Show resolved Hide resolved
+ baseUrl = baseUrl.replace(/\/+$/, ""); // Trim any trailing `/` chars.
+ baseUrl = baseUrl.replace(/(\/+|\/*#.*|\/*\?.*)$/, ""); // Strip off trailing `/`, `#`, `?` and everything after.
BlackDex marked this conversation as resolved.
Show resolved Hide resolved
+ const urls = { base: baseUrl };

// Find the region
const domain = Utils.getDomain(this.win.location.href);
diff --git a/apps/web/src/app/shared/loose-components.module.ts b/apps/web/src/app/shared/loose-components.module.ts
Expand Down