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