From 395f50638ac9005a20b80f4ee1c15fd477e06197 Mon Sep 17 00:00:00 2001 From: Selina Li Date: Mon, 6 Feb 2023 21:51:15 -0500 Subject: [PATCH] Add validation when creating a new preset in BE --- src/main/main.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/main.ts b/src/main/main.ts index 278720bca..d6588a412 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -222,6 +222,12 @@ ipcMain.on(ChannelEnum.SAVE_PRESET, async (event, arg) => { const presetName = arg[0]; console.log(`Saving preset: ${presetName}`); try { + // Validate that the preset name is not restricted + if (isRestrictedPresetName(presetName)) { + handleError(event, channel, ErrorCode.INVALID_PRESET_NAME); + return; + } + savePreset(presetName, { preAmp: state.preAmp, filters: state.filters,