Skip to content

Commit

Permalink
Add validation when creating a new preset in BE
Browse files Browse the repository at this point in the history
  • Loading branch information
selinali2010 committed Feb 7, 2023
1 parent 1225c51 commit 395f506
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 395f506

Please sign in to comment.