2
0

🚑 Fix customDomain regex validation

This commit is contained in:
Baptiste Arnaud
2023-08-17 09:55:52 +02:00
parent 454d320c6b
commit fca5865999
4 changed files with 17 additions and 5 deletions

View File

@ -26,7 +26,7 @@ export const ImportTypebotFromFileButton = ({
updatedAt: true,
})
.parse(typebot)
onNewTypebot(typebot)
onNewTypebot(typebot as Typebot)
} catch (err) {
console.error(err)
showToast({

View File

@ -4,6 +4,8 @@ import { TRPCError } from '@trpc/server'
import { publicTypebotSchema } from '@typebot.io/schemas'
import { z } from 'zod'
import { isReadTypebotForbidden } from '../helpers/isReadTypebotForbidden'
import { parseInvalidTypebot } from '../helpers/parseInvalidTypebot'
import { PublicTypebot } from '@typebot.io/schemas'
export const getPublishedTypebot = authenticatedProcedure
.meta({
@ -48,7 +50,7 @@ export const getPublishedTypebot = authenticatedProcedure
try {
const parsedTypebot = publicTypebotSchema.parse(
existingTypebot.publishedTypebot
parseInvalidTypebot(existingTypebot.publishedTypebot as PublicTypebot)
)
return {

View File

@ -1,6 +1,8 @@
import { Edge, Typebot, edgeSchema } from '@typebot.io/schemas'
import { Edge, PublicTypebot, Typebot, edgeSchema } from '@typebot.io/schemas'
export const parseInvalidTypebot = (typebot: Typebot): Typebot => ({
export const parseInvalidTypebot = (
typebot: Typebot | PublicTypebot
): Typebot | PublicTypebot => ({
...typebot,
version: typebot.version as null | '3' | '4' | '5',
edges: parseInvalidEdges(typebot.edges),