Fixes successRedirectUrl validation
parent
14443099e0
commit
6179b3fbe0
|
@ -854,7 +854,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
|||
seatsPerTimeSlot,
|
||||
recurringEvent,
|
||||
locations,
|
||||
successRedirectUrl,
|
||||
...input
|
||||
} = values;
|
||||
|
||||
|
@ -868,7 +867,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
|||
id: eventType.id,
|
||||
beforeEventBuffer: beforeBufferTime,
|
||||
afterEventBuffer: afterBufferTime,
|
||||
successRedirectUrl: successRedirectUrl || undefined,
|
||||
seatsPerTimeSlot,
|
||||
metadata: {
|
||||
...(smartContractAddress ? { smartContractAddress } : {}),
|
||||
|
|
|
@ -118,15 +118,12 @@ export const userMetadata = z
|
|||
* - XSS attempts through javascript:alert('hi')
|
||||
* - mailto: links
|
||||
*/
|
||||
export function assertValidUrl(url: string) {
|
||||
return url.startsWith("http://") && url.startsWith("https://");
|
||||
}
|
||||
|
||||
export const successRedirectUrl = z
|
||||
.string()
|
||||
.url()
|
||||
.refine(assertValidUrl, {
|
||||
path: ["successRedirectUrl"],
|
||||
message: "Invalid URL",
|
||||
})
|
||||
.nullish();
|
||||
.union([
|
||||
z.literal(""),
|
||||
z
|
||||
.string()
|
||||
.url()
|
||||
.regex(/^http(s)?:\/\/.*/),
|
||||
])
|
||||
.optional();
|
||||
|
|
Loading…
Reference in New Issue