mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: redirect URL preventing document flow (#925)
## Description Currently the document redirect URL feature is preventing documents from being created unless a redirect URL is provided. During the document edit flow, the redirect URL is hidden in an advanced tab with the value of an empty string, which will always fail the current Zod validation since `optional` requires undefined to pass. There are multiple ways to fix this, but I think this is the easiest method where we can assume an empty string is valid.
This commit is contained in:
@ -77,7 +77,7 @@ export const ZSendDocumentMutationSchema = z.object({
|
||||
redirectUrl: z
|
||||
.string()
|
||||
.optional()
|
||||
.refine((value) => value === undefined || URL_REGEX.test(value), {
|
||||
.refine((value) => value === undefined || value === '' || URL_REGEX.test(value), {
|
||||
message: 'Please enter a valid URL',
|
||||
}),
|
||||
}),
|
||||
|
||||
@ -13,7 +13,7 @@ export const ZAddSubjectFormSchema = z.object({
|
||||
redirectUrl: z
|
||||
.string()
|
||||
.optional()
|
||||
.refine((value) => value === undefined || URL_REGEX.test(value), {
|
||||
.refine((value) => value === undefined || value === '' || URL_REGEX.test(value), {
|
||||
message: 'Please enter a valid URL',
|
||||
}),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user