fix(editor): 🐛 Fix basic auth header without ':'
This commit is contained in:
@ -39,7 +39,6 @@ export const TemplatesContent = () => {
|
|||||||
const { error, data } = typebot
|
const { error, data } = typebot
|
||||||
? await importTypebot({
|
? await importTypebot({
|
||||||
...typebot,
|
...typebot,
|
||||||
id: generate(),
|
|
||||||
ownerId: user.id,
|
ownerId: user.id,
|
||||||
folderId,
|
folderId,
|
||||||
})
|
})
|
||||||
|
@ -91,12 +91,21 @@ export const createTypebot = async ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const importTypebot = async (typebot: Typebot) =>
|
export const importTypebot = async (typebot: Typebot) => {
|
||||||
sendRequest<Typebot>({
|
const typebotToImport: Omit<Typebot, 'id'> = omit(
|
||||||
|
{
|
||||||
|
...typebot,
|
||||||
|
publishedTypebotId: null,
|
||||||
|
publicId: null,
|
||||||
|
},
|
||||||
|
'id'
|
||||||
|
)
|
||||||
|
return sendRequest<Typebot>({
|
||||||
url: `/api/typebots`,
|
url: `/api/typebots`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: typebot,
|
body: typebotToImport,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const duplicateTypebot = async (typebotId: string) => {
|
export const duplicateTypebot = async (typebotId: string) => {
|
||||||
const { data } = await getTypebot(typebotId)
|
const { data } = await getTypebot(typebotId)
|
||||||
|
@ -68,7 +68,10 @@ const executeWebhook =
|
|||||||
h.key?.toLowerCase() === 'authorization' &&
|
h.key?.toLowerCase() === 'authorization' &&
|
||||||
h.value?.toLowerCase()?.includes('basic')
|
h.value?.toLowerCase()?.includes('basic')
|
||||||
)
|
)
|
||||||
if (basicAuthHeaderIdx !== -1) {
|
const isUsernamePasswordBasicAuth =
|
||||||
|
basicAuthHeaderIdx !== -1 &&
|
||||||
|
webhook.headers[basicAuthHeaderIdx].value?.includes(':')
|
||||||
|
if (isUsernamePasswordBasicAuth) {
|
||||||
const [username, password] =
|
const [username, password] =
|
||||||
webhook.headers[basicAuthHeaderIdx].value?.slice(6).split(':') ?? []
|
webhook.headers[basicAuthHeaderIdx].value?.slice(6).split(':') ?? []
|
||||||
basicAuth.username = username
|
basicAuth.username = username
|
||||||
|
Reference in New Issue
Block a user