-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix URL validation by preserving percent-encoded characters (#9326)
- Loading branch information
1 parent
2cd1fa2
commit 8cb70c9
Showing
2 changed files
with
6 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@keystone-6/fields-document": patch | ||
--- | ||
|
||
Fixes URL validation bug by using `encodeURI` to preserve percent-encoded characters during validation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { sanitizeUrl } from '@braintree/sanitize-url' | ||
|
||
export function isValidURL (url: string) { | ||
return url === sanitizeUrl(url) | ||
return url === sanitizeUrl(url) || url === encodeURI(sanitizeUrl(url)) | ||
} |