Skip to content

Commit cfb4c39

Browse files
authored
fix(core): add trim url validation (#198)
1 parent b90fa47 commit cfb4c39

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

core/api/src/graphql/admin/types/scalar/external-url.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const ExternalUrl = GT.Scalar({
2121
})
2222

2323
function validUrlValue(value: string) {
24+
if (value !== value.trim()) {
25+
return new InputValidationError({ message: "Invalid value for ExternalUrl" })
26+
}
27+
2428
try {
2529
const url = new URL(value)
2630
if (url.protocol !== "https:" && url.protocol !== "http:") {

core/api/src/graphql/public/types/scalar/endpoint-url.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const EndpointUrl = GT.Scalar({
2121
})
2222

2323
function validUrlValue(value: string) {
24+
if (value !== value.trim()) {
25+
return new InputValidationError({ message: "Invalid value for EndpointUrl" })
26+
}
27+
2428
try {
2529
const url = new URL(value)
2630
if (url.protocol !== "https:" && url.protocol !== "http:") {

0 commit comments

Comments
 (0)