We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2676206 commit eb20ff6Copy full SHA for eb20ff6
.changeset/lemon-bags-tan.md
@@ -0,0 +1,5 @@
1
+---
2
+"@atproto/common-web": patch
3
4
+
5
+ponyfill URL.canParse
packages/common-web/src/did-doc.ts
@@ -145,13 +145,25 @@ const validateUrl = (urlStr: string): string | undefined => {
145
return undefined
146
}
147
148
- if (!URL.canParse(urlStr)) {
+ if (!canParseUrl(urlStr)) {
149
150
151
152
return urlStr
153
154
155
+const canParseUrl =
156
+ URL.canParse ??
157
+ // URL.canParse is not available in Node.js < 18.17.0
158
+ ((urlStr: string): boolean => {
159
+ try {
160
+ new URL(urlStr)
161
+ return true
162
+ } catch {
163
+ return false
164
+ }
165
+ })
166
167
// Types
168
// --------
169
0 commit comments