From 64322a2ed19fb7d595eaddfc0b4cdbbbcbe79456 Mon Sep 17 00:00:00 2001 From: Seif Soliman Date: Tue, 1 Jul 2025 14:00:57 +0300 Subject: [PATCH] fix(commandline): prevent duplicate entries in Polyglot and Layoutfluid funbox modes (@byseif21) (#6684) ### Description #### Issue: * It was possible to add duplicate languages to Polyglot mode or duplicate layouts to Layoutfluid mode via the command line #### fix: * Prevent duplicate entries in Polyglot and Layoutfluid configs by deduplicating values before saving, ensuring unique values regardless of input source. --- frontend/src/ts/config.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/ts/config.ts b/frontend/src/ts/config.ts index 81a854dca..8bf21ae51 100644 --- a/frontend/src/ts/config.ts +++ b/frontend/src/ts/config.ts @@ -1871,17 +1871,19 @@ export function setCustomLayoutfluid( value: ConfigSchemas.CustomLayoutFluid, nosave?: boolean ): boolean { + // Remove duplicates + const deduped = Array.from(new Set(value)); if ( !isConfigValueValid( "layoutfluid", - value, + deduped, ConfigSchemas.CustomLayoutFluidSchema ) ) { return false; } - config.customLayoutfluid = value; + config.customLayoutfluid = deduped; saveToLocalStorage("customLayoutfluid", nosave); ConfigEvent.dispatch("customLayoutfluid", config.customLayoutfluid); @@ -1892,16 +1894,18 @@ export function setCustomPolyglot( value: ConfigSchemas.CustomPolyglot, nosave?: boolean ): boolean { + // remove duplicates + const deduped = Array.from(new Set(value)); if ( !isConfigValueValid( "customPolyglot", - value, + deduped, ConfigSchemas.CustomPolyglotSchema ) ) return false; - config.customPolyglot = value; + config.customPolyglot = deduped; saveToLocalStorage("customPolyglot", nosave); ConfigEvent.dispatch("customPolyglot", config.customPolyglot);