diff --git a/backend/serdes/views.py b/backend/serdes/views.py index 4e1a7ef5f..f22adbb48 100644 --- a/backend/serdes/views.py +++ b/backend/serdes/views.py @@ -1,3 +1,4 @@ +import gzip import io import json import sys @@ -10,7 +11,6 @@ from rest_framework.parsers import FileUploadParser from rest_framework.response import Response from rest_framework.views import APIView -import gzip, io from ciso_assistant.settings import VERSION from serdes.serializers import LoadBackupSerializer @@ -22,9 +22,9 @@ def get(self, request, *args, **kwargs): return Response(status=status.HTTP_403_FORBIDDEN) response = HttpResponse(content_type="application/json") timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") - response["Content-Disposition"] = ( - f'attachment; filename="ciso-assistant-db-{timestamp}.json"' - ) + response[ + "Content-Disposition" + ] = f'attachment; filename="ciso-assistant-db-{timestamp}.json"' buffer = io.StringIO() buffer.write(f'[{{"meta": [{{"media_version": "{VERSION}"}}]}},\n') diff --git a/frontend/src/routes/(app)/backup-restore/+page.svelte b/frontend/src/routes/(app)/backup-restore/+page.svelte index 404c54d86..d88138047 100644 --- a/frontend/src/routes/(app)/backup-restore/+page.svelte +++ b/frontend/src/routes/(app)/backup-restore/+page.svelte @@ -3,7 +3,6 @@ import { page } from '$app/stores'; import * as m from '$paraglide/messages'; - const authorizedExtensions = ['.json', '.gz']; import { getModalStore, type ModalSettings } from '@skeletonlabs/skeleton'; const modalStore = getModalStore(); @@ -16,19 +15,20 @@ type: 'confirm', title: m.importBackup(), body: m.confirmImportBackup(), - response: (r: boolean) => form.requestSubmit() + response: () => form.requestSubmit() }; if (file) modalStore.trigger(modal); } $: uploadButtonStyles = file ? '' : 'chip-disabled'; + const authorizedExtensions = ['.json', '.gz']; const user = $page.data.user; const canBackup: boolean = Object.hasOwn(user.permissions, 'backup'); {#if canBackup} -