Skip to content

Commit 33fed6d

Browse files
committed
Convert URL back to string before running normalization
1 parent 7d2050a commit 33fed6d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/resolvers/records.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const normalizeSiteLocation = (siteLocation) => {
1414
}
1515

1616
try {
17-
return normalizeUrl(siteLocation)
17+
return normalizeUrl(siteLocation.toString())
1818
} catch (error) {
1919
throw new KnownError(`Failed to normalize \`siteLocation\``, error)
2020
}
@@ -25,7 +25,7 @@ const normalizeSiteReferrer = (siteReferrer) => {
2525
if (siteReferrer == null) return siteReferrer
2626

2727
try {
28-
return normalizeUrl(siteReferrer)
28+
return normalizeUrl(siteReferrer.toString())
2929
} catch (error) {
3030
throw new KnownError(`Failed to normalize \`siteReferrer\``, error)
3131
}

test/resolvers/records.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ test.serial('reject record with invalid siteLocation', async (t) => {
137137

138138
const { json } = await api(base, body, t.context.token.id)
139139

140-
t.is(json.data, null)
140+
t.is(json.data, undefined)
141141
t.truthy(json.errors)
142142
t.is(json.errors.length, 1)
143143
t.true(json.errors[0].message.includes('Invalid URL'))
@@ -166,7 +166,7 @@ test.serial('reject record with invalid siteReferrer', async (t) => {
166166

167167
const { json } = await api(base, body, t.context.token.id)
168168

169-
t.is(json.data, null)
169+
t.is(json.data, undefined)
170170
t.truthy(json.errors)
171171
t.is(json.errors.length, 1)
172172
t.true(json.errors[0].message.includes('Invalid URL'))

0 commit comments

Comments
 (0)