From 86e5c611ec36f39b8fdfec4d7fe5c68f16b576ea Mon Sep 17 00:00:00 2001 From: Jorge Montejo Date: Mon, 5 Jan 2026 12:28:08 +0100 Subject: [PATCH] fix: import config from json (#25030) Co-authored-by: Daniel Dietzler --- web/src/lib/services/system-config.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/lib/services/system-config.service.ts b/web/src/lib/services/system-config.service.ts index b8c7716d47..022ad8b8bb 100644 --- a/web/src/lib/services/system-config.service.ts +++ b/web/src/lib/services/system-config.service.ts @@ -96,7 +96,7 @@ export const handleDownloadConfig = (config: SystemConfigDto) => { export const handleUploadConfig = () => { const input = globalThis.document.createElement('input'); input.setAttribute('type', 'file'); - input.setAttribute('accept', 'json'); + input.setAttribute('accept', '.json'); input.setAttribute('style', 'display: none'); input.addEventListener('change', ({ target }) => { @@ -109,8 +109,10 @@ export const handleUploadConfig = () => { const newConfig = JSON.parse(text); await handleSystemConfigSave(newConfig); }; - reader().catch((error) => console.error('Error handling JSON config upload', error)); - globalThis.document.append(input); + reader() + .catch((error) => console.error('Error handling JSON config upload', error)) + .finally(() => input.remove()); }); - input.remove(); + globalThis.document.body.append(input); + input.click(); };