Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

fix split cuased by defaultParameters breaking dynamic endpoint tools (#5838)

Anthony Stirling8b25db37ad00
diff --git a/app/core/src/main/resources/settings.yml.template b/app/core/src/main/resources/settings.yml.template
index 53c252e2db..4ffa2f9fac 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 197d936127..63dd88a64f 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";