diff --git a/apps/builder/layouts/dashboard/TemplatesContent.tsx b/apps/builder/layouts/dashboard/TemplatesContent.tsx index d714d998a..788ccead8 100644 --- a/apps/builder/layouts/dashboard/TemplatesContent.tsx +++ b/apps/builder/layouts/dashboard/TemplatesContent.tsx @@ -39,7 +39,6 @@ export const TemplatesContent = () => { const { error, data } = typebot ? await importTypebot({ ...typebot, - id: generate(), ownerId: user.id, folderId, }) diff --git a/apps/builder/services/typebots/typebots.ts b/apps/builder/services/typebots/typebots.ts index 4de3e04f6..fa94374cc 100644 --- a/apps/builder/services/typebots/typebots.ts +++ b/apps/builder/services/typebots/typebots.ts @@ -91,12 +91,21 @@ export const createTypebot = async ({ }) } -export const importTypebot = async (typebot: Typebot) => - sendRequest({ +export const importTypebot = async (typebot: Typebot) => { + const typebotToImport: Omit = omit( + { + ...typebot, + publishedTypebotId: null, + publicId: null, + }, + 'id' + ) + return sendRequest({ url: `/api/typebots`, method: 'POST', - body: typebot, + body: typebotToImport, }) +} export const duplicateTypebot = async (typebotId: string) => { const { data } = await getTypebot(typebotId) diff --git a/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts b/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts index 4e4d4e3e8..96eb750c9 100644 --- a/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts +++ b/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts @@ -68,7 +68,10 @@ const executeWebhook = h.key?.toLowerCase() === 'authorization' && h.value?.toLowerCase()?.includes('basic') ) - if (basicAuthHeaderIdx !== -1) { + const isUsernamePasswordBasicAuth = + basicAuthHeaderIdx !== -1 && + webhook.headers[basicAuthHeaderIdx].value?.includes(':') + if (isUsernamePasswordBasicAuth) { const [username, password] = webhook.headers[basicAuthHeaderIdx].value?.slice(6).split(':') ?? [] basicAuth.username = username