Skip to content

Commit 1f54e10

Browse files
authored
Merge pull request #529 from igorkamyshev/fix-safari-14-0-issue-with-url
2 parents f13a916 + 5a28d32 commit 1f54e10

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/heavy-otters-hang.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@farfetched/core": patch
3+
---
4+
5+
Add workaround for Safari 14.0 bugged implementation of URL constructor

packages/core/src/fetch/lib.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,14 @@ export function formatUrl(
9393
urlString = `${url}?${queryString}`;
9494
}
9595

96+
/**
97+
* Workararound for Safari 14.0
98+
* @see https://github.com/igorkamyshev/farfetched/issues/528
99+
*/
100+
const urlArgs = [urlString, urlBase].filter(Boolean) as [string, string];
101+
96102
try {
97-
return new URL(urlString, urlBase);
103+
return new URL(...urlArgs);
98104
} catch (e) {
99105
throw configurationError({
100106
reason: 'Invalid URL',

0 commit comments

Comments
 (0)