Skip to content

Commit

Permalink
fix: correctly parse hostname for instance block (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Jul 9, 2019
1 parent 6b40b2e commit 0e24795
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/routes/_actions/addInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ async function redirectToOauth () {
if (Object.keys(loggedInInstances).includes(instanceNameInSearch)) {
throw createKnownError(`You've already logged in to ${instanceNameInSearch}`)
}
if (DOMAIN_BLOCKS.some(domain => new RegExp(`(?:\\.|^)${domain}$`, 'i').test(instanceNameInSearch))) {
let instanceHostname = new URL(`http://${instanceNameInSearch}`).hostname
if (DOMAIN_BLOCKS.some(domain => new RegExp(`(?:\\.|^)${domain}$`, 'i').test(instanceHostname))) {
throw createKnownError('This service is blocked')
}
let registrationPromise = registerApplication(instanceNameInSearch, REDIRECT_URI)
Expand Down

0 comments on commit 0e24795

Please sign in to comment.