Skip to content

Commit 20f4608

Browse files
committed
Add acct: prefix strip
1 parent 3f85acc commit 20f4608

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

web-next/src/routes/(root)/authorize_interaction.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ import { Button } from "~/components/ui/button.tsx";
2222
import { useLingui } from "~/lib/i18n/macro.d.ts";
2323
import type { authorizeInteractionPageQuery } from "./__generated__/authorizeInteractionPageQuery.graphql.ts";
2424

25+
function stripAcctPrefix(uri: string): string {
26+
return uri.replace(/^acct:/i, "");
27+
}
28+
2529
export const route = {
2630
preload(args) {
27-
const uri = new URLSearchParams(args.location.search).get("uri") ?? "";
31+
const raw = new URLSearchParams(args.location.search).get("uri") ?? "";
32+
const uri = stripAcctPrefix(raw);
2833
if (uri) {
2934
void loadPageQuery(uri);
3035
}
@@ -66,7 +71,10 @@ const loadPageQuery = query(
6671
export default function AuthorizeInteractionPage() {
6772
const { t } = useLingui();
6873
const [searchParams] = useSearchParams();
69-
const uri = () => searchParams.uri as string | undefined;
74+
const uri = () => {
75+
const raw = searchParams.uri as string | undefined;
76+
return raw ? stripAcctPrefix(raw) : undefined;
77+
};
7078

7179
return (
7280
<div class="p-4">

0 commit comments

Comments
 (0)