Skip to content

Commit

Permalink
do not remove double slashes if part of a protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
laperlej committed Oct 10, 2024
1 parent 01512cb commit 7fa9314
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions client/src/utils/redirect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ test("route prefix changes", async () => {
expect(withPrefix("http://")).toEqual("http://");
expect(withPrefix("/")).toEqual("/prefix/");
expect(withPrefix("/home")).toEqual("/prefix/home");
// keep protocols in query parameters intact
expect(withPrefix("/authz/cilogon/login?idphint=https://test.com")).toEqual(
"/prefix/authz/cilogon/login?idphint=https://test.com"
);
// ensure that it can only be called once
expect(withPrefix(withPrefix("/home"))).toEqual("/prefix/prefix/home");
// This doesn't do what it looks like it should do?
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function reloadPage() {
window.location.reload();
}

const slashCleanup = /(\/)+/g;
const slashCleanup = /(?<!:)(\/)+/g;
/**
* Prepends the configured app root to given url
* @param path
Expand Down

0 comments on commit 7fa9314

Please sign in to comment.