mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-20 11:22:55 -05:00
fix: add defensive checks for survey.endings in API and migration
- Add null check in app sync utils for recall info replacement - Add null check in database migration for endings cleanup
This commit is contained in:
@@ -38,7 +38,7 @@ export const replaceAttributeRecall = (survey: TSurvey, attributes: TAttributes)
|
||||
}
|
||||
});
|
||||
}
|
||||
surveyTemp.endings.forEach((ending) => {
|
||||
(surveyTemp.endings ?? []).forEach((ending) => {
|
||||
if (ending.type === "endScreen") {
|
||||
languages.forEach((language) => {
|
||||
if (ending.headline && ending.headline[language]?.includes("recall:")) {
|
||||
|
||||
@@ -62,7 +62,7 @@ export const removeEmptyImageAndVideoUrlsFromElements: MigrationScript = {
|
||||
delete cleanedWelcomeCard.videoUrl;
|
||||
}
|
||||
|
||||
const cleanedEndings = survey.endings.map((ending) => {
|
||||
const cleanedEndings = (survey.endings ?? []).map((ending) => {
|
||||
const cleanedEnding = { ...ending };
|
||||
if (cleanedEnding.imageUrl === "") {
|
||||
delete cleanedEnding.imageUrl;
|
||||
|
||||
Reference in New Issue
Block a user