fix(portal): localPart is string | undefined under noUncheckedIndexedAccess
ci / tc_booking (push) Has been skipped
ci / tc_operator (push) Has been skipped
ci / tc_website (push) Has been skipped
ci / changes (push) Successful in 4s
ci / build_portal (push) Successful in 50s
ci / deploy (push) Successful in 39s
ci / tc_platform_api (push) Has been skipped
ci / test_platform_api (push) Has been skipped
ci / build_booking (push) Has been skipped
ci / build_operator (push) Has been skipped
ci / build_platform_api (push) Has been skipped
ci / tc_portal (push) Successful in 26s

split('@')[0] needs a fallback even though the email regex guarantees the
separator — portal typecheck (CI) rejected the mobileconfig route.
This commit is contained in:
Ronni Baslund
2026-06-11 07:49:07 +02:00
parent a5d82903af
commit d964efcab7
@@ -36,7 +36,8 @@ export default defineEventHandler(async (event) => {
} }
const mailHost = new URL(useRuntimeConfig().public.mailUrl as string).host const mailHost = new URL(useRuntimeConfig().public.mailUrl as string).host
const localPart = email.split('@')[0] // The regex above guarantees an @, but noUncheckedIndexedAccess doesn't know.
const localPart = email.split('@')[0] ?? email
const accountUuid = randomUUID() const accountUuid = randomUUID()
const profileUuid = randomUUID() const profileUuid = randomUUID()
const e = xmlEscape(email) const e = xmlEscape(email)