From 8b25db37ad0077f0142dd9afda94803eb60f2bd2 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 2 Mar 2026 13:55:58 +0000 Subject: [PATCH] fix split cuased by defaultParameters breaking dynamic endpoint tools (#5838) --- app/core/src/main/resources/settings.yml.template | 2 +- .../src/core/hooks/tools/split/useSplitOperation.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/core/src/main/resources/settings.yml.template b/app/core/src/main/resources/settings.yml.template index 53c252e2d..4ffa2f9fa 100644 --- a/app/core/src/main/resources/settings.yml.template +++ b/app/core/src/main/resources/settings.yml.template @@ -173,7 +173,7 @@ system: corsAllowedOrigins: [] # List of allowed origins for CORS (e.g. ['http://localhost:5173', 'https://app.example.com']). Leave empty to disable CORS. For local development with frontend on port 5173, add 'http://localhost:5173' backendUrl: "" # Backend base URL for SAML/OAuth/API callbacks (e.g. 'http://localhost:8080' for dev, 'https://api.example.com' for production). REQUIRED for SSO authentication to work correctly. This is where your IdP will send SAML responses and OAuth callbacks. Leave empty to default to 'http://localhost:8080' in development. frontendUrl: "" # Frontend URL for invite email links (e.g. 'https://app.example.com'). Optional - if not set, will use backendUrl. This is the URL users click in invite emails. - enableMobileScanner: false # Enable mobile phone QR code upload feature. Requires frontendUrl to be configured. + enableMobileScanner: true # Enable mobile phone QR code upload feature. Requires frontendUrl to be configured. mobileScannerSettings: convertToPdf: true # Automatically convert uploaded images to PDF format. If false, images are kept as-is. imageResolution: full # Image resolution for mobile uploads: 'full' (original size) or 'reduced' (max 1200px on longest side). Only applies when convertToPdf is true. diff --git a/frontend/src/core/hooks/tools/split/useSplitOperation.ts b/frontend/src/core/hooks/tools/split/useSplitOperation.ts index 197d93612..63dd88a64 100644 --- a/frontend/src/core/hooks/tools/split/useSplitOperation.ts +++ b/frontend/src/core/hooks/tools/split/useSplitOperation.ts @@ -12,7 +12,10 @@ export const buildSplitFormData = (parameters: SplitParameters, file: File): For formData.append("fileInput", file); - switch (parameters.method) { + // Use BY_PAGES as default if no method is selected + const method = parameters.method || SPLIT_METHODS.BY_PAGES; + + switch (method) { case SPLIT_METHODS.BY_PAGES: formData.append("pageNumbers", parameters.pages); break; @@ -52,13 +55,18 @@ export const buildSplitFormData = (parameters: SplitParameters, file: File): For formData.append("rightToLeft", (parameters.rightToLeft ?? false).toString()); break; default: - throw new Error(`Unknown split method: ${parameters.method}`); + throw new Error(`Unknown split method: ${method}`); } return formData; }; export const getSplitEndpoint = (parameters: SplitParameters): string => { + // Default to BY_PAGES endpoint if no method selected yet + if (!parameters.method) { + return "/api/v1/general/split-pages"; + } + switch (parameters.method) { case SPLIT_METHODS.BY_PAGES: return "/api/v1/general/split-pages";