Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieusieben committed Jan 24, 2025
1 parent c61bf36 commit 3b2a2c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/did/src/methods/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export function didWebToUrl(did: string) {
try {
const url = new URL(
`https://${host.replaceAll('%3A', ':')}${path.replaceAll(':', '/')}`,
)
) as URL & { protocol: 'http:' | 'https:' }
if (url.hostname === 'localhost') {
url.protocol = 'http:'
}
return url as URL & { protocol: 'http:' | 'https:' }
return url
} catch (cause) {
throw new InvalidDidError(did, 'Invalid Web DID', cause)
}
Expand Down

0 comments on commit 3b2a2c3

Please sign in to comment.