We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f2d8d2 commit ad14db1Copy full SHA for ad14db1
1 file changed
app/routes/auth/ott.tsx
@@ -27,7 +27,17 @@ export default function Ott() {
27
setLoading(false);
28
} else {
29
toast.success("Logged in");
30
- navigate(new URL(redirect || "").pathname);
+ if (redirect && redirect.trim() !== "") {
31
+ try {
32
+ const redirectUrl = new URL(redirect);
33
+ navigate(redirectUrl.pathname);
34
+ } catch {
35
+ // If redirect is not a valid URL, treat it as a relative path
36
+ navigate(redirect);
37
+ }
38
+ } else {
39
+ navigate("/");
40
41
}
42
} catch (error) {
43
setMessage("Something went wrong");
0 commit comments