Skip to content

Commit 1a23c5b

Browse files
authored
Onboarding: Guard deployedURL (#1373)
1 parent e65e7f3 commit 1a23c5b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changeset/nice-parrots-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@keystatic/core': patch
3+
---
4+
5+
During onboarding, make sure the Deployed App URL does not have double slashes.

packages/keystatic/src/app/onboarding/setup.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ export function KeystaticSetup(props: { config: GitHubConfig }) {
7777
parseRepoConfig(props.config.storage.repo).owner
7878
} Keystatic`,
7979
url: deployedURL
80-
? `${deployedURL}/keystatic`
80+
? new URL('/keystatic', deployedURL).toString()
8181
: `${window.location.origin}/keystatic`,
8282
public: true,
8383
redirect_url: `${window.location.origin}/api/keystatic/github/created-app`,
8484
callback_urls: [
8585
`${window.location.origin}/api/keystatic/github/oauth/callback`,
8686
`http://127.0.0.1/api/keystatic/github/oauth/callback`,
8787
...(deployedURL
88-
? [`${deployedURL}/api/keystatic/github/oauth/callback`]
88+
? [
89+
new URL(
90+
'/api/keystatic/github/oauth/callback',
91+
deployedURL
92+
).toString(),
93+
]
8994
: []),
9095
],
9196
request_oauth_on_install: true,

0 commit comments

Comments
 (0)