Skip to content

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

minor changes (#5419)

Anthony Stirlingdd09f7b7cf6e
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java
index 91f892761b..44b350e9ee 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/SplitPdfBySectionsController.java
@@ -29,6 +29,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import stirling.software.SPDF.model.SplitTypes;
import stirling.software.SPDF.model.api.SplitPdfBySectionsRequest;
@@ -40,6 +41,7 @@ import stirling.software.common.util.TempFile;
import stirling.software.common.util.TempFileManager;
import stirling.software.common.util.WebResponseUtils;
+@Slf4j
@RestController
@RequestMapping("/api/v1/general")
@Tag(name = "General", description = "General APIs")
@@ -98,6 +100,9 @@ public class SplitPdfBySectionsController {
}
}
mergedDoc.save(out);
+ } catch (IOException e) {
+ log.error("Error creating merged PDF document", e);
+ throw e;
}
return WebResponseUtils.pdfFileToWebResponse(tempFile, filename + ".pdf");
} else {
@@ -132,6 +137,13 @@ public class SplitPdfBySectionsController {
+ sectionNum
+ ".pdf";
saveDocToZip(subDoc, zipOut, entryName);
+ } catch (IOException e) {
+ log.error(
+ "Error creating section {} for page {}",
+ (i * verti + j + 1),
+ pageNum,
+ e);
+ throw e;
}
}
}
@@ -141,12 +153,21 @@ public class SplitPdfBySectionsController {
addPageToTarget(sourceDocument, pageIndex, subDoc, subLayerUtility);
String entryName = filename + "_" + pageNum + "_1.pdf";
saveDocToZip(subDoc, zipOut, entryName);
+ } catch (IOException e) {
+ log.error("Error processing unsplit page {}", pageNum, e);
+ throw e;
}
}
}
+ } catch (IOException e) {
+ log.error("Error creating ZIP file with split PDF sections", e);
+ throw e;
}
return WebResponseUtils.zipFileToWebResponse(zipTempFile, filename + ".zip");
}
+ } catch (Exception e) {
+ log.error("Error splitting PDF file: {}", file.getOriginalFilename(), e);
+ throw e;
}
}
@@ -161,6 +182,9 @@ public class SplitPdfBySectionsController {
try (PDPageContentStream contentStream =
new PDPageContentStream(targetDoc, newPage, AppendMode.APPEND, true, true)) {
contentStream.drawForm(form);
+ } catch (IOException e) {
+ log.error("Error adding page {} to target document", pageIndex, e);
+ throw e;
}
}
@@ -198,6 +222,10 @@ public class SplitPdfBySectionsController {
contentStream.transform(new Matrix(1, 0, 0, 1, translateX, translateY));
contentStream.drawForm(form);
contentStream.restoreGraphicsState();
+ } catch (IOException e) {
+ log.error(
+ "Error adding split section ({}, {}) for page {}", i, j, pageIndex, e);
+ throw e;
}
}
}
@@ -234,6 +262,14 @@ public class SplitPdfBySectionsController {
contentStream.transform(new Matrix(1, 0, 0, 1, translateX, translateY));
contentStream.drawForm(form);
contentStream.restoreGraphicsState();
+ } catch (IOException e) {
+ log.error(
+ "Error adding single section ({}, {}) for page {} to target",
+ horizIndex,
+ vertIndex,
+ pageIndex,
+ e);
+ throw e;
}
}
diff --git a/frontend/src/proprietary/components/shared/config/configSections/PeopleSection.tsx b/frontend/src/proprietary/components/shared/config/configSections/PeopleSection.tsx
index a43ac3078e..cb8a2d8b76 100644
--- a/frontend/src/proprietary/components/shared/config/configSections/PeopleSection.tsx
+++ b/frontend/src/proprietary/components/shared/config/configSections/PeopleSection.tsx
@@ -353,12 +353,12 @@ export default function PeopleSection() {
{/* License Information - Compact */}
{licenseInfo && (
- <Group gap="md" c="dimmed" style={{ fontSize: '0.875rem' }}>
- <Text size="sm" span>
+ <Group gap="md" style={{ fontSize: '0.875rem' }}>
+ <Text size="sm" span c="dimmed">
<Text component="span" fw={600} c="inherit">{licenseInfo.totalUsers}</Text>
<Text component="span" c="dimmed"> / </Text>
<Text component="span" fw={600} c="inherit">{licenseInfo.maxAllowedUsers}</Text>
- <Text component="span" c="dimmed" ml={4}>{t('workspace.people.license.users', 'users')}</Text>
+ <Text component="span" c="dimmed"> {t('workspace.people.license.users', 'users')}</Text>
</Text>
{licenseInfo.availableSlots === 0 && (
@@ -518,7 +518,7 @@ export default function PeopleSection() {
<Badge
size="sm"
variant="light"
- color={(user.rolesAsString || '').includes('ROLE_ADMIN') ? 'blue' : 'gray'}
+ color={(user.rolesAsString || '').includes('ROLE_ADMIN') ? 'blue' : 'cyan'}
>
{(user.rolesAsString || '').includes('ROLE_ADMIN')
? t('workspace.people.admin', 'Admin')
diff --git a/frontend/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx b/frontend/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx
index c4f91d969e..dc45856537 100644
--- a/frontend/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx
+++ b/frontend/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx
@@ -362,7 +362,7 @@ export default function TeamDetailsSection({ teamId, onBack }: TeamDetailsSectio
<Table.Td w={100}>
<Badge
size="sm"
- color={(user.rolesAsString || '').includes('ROLE_ADMIN') ? 'blue' : 'gray'}
+ color={(user.rolesAsString || '').includes('ROLE_ADMIN') ? 'blue' : 'cyan'}
variant="light"
>
{(user.rolesAsString || '').includes('ROLE_ADMIN')
diff --git a/frontend/src/proprietary/components/shared/config/configSections/TeamsSection.tsx b/frontend/src/proprietary/components/shared/config/configSections/TeamsSection.tsx
index eb256bc209..b2b9b986ae 100644
--- a/frontend/src/proprietary/components/shared/config/configSections/TeamsSection.tsx
+++ b/frontend/src/proprietary/components/shared/config/configSections/TeamsSection.tsx
@@ -280,7 +280,6 @@ export default function TeamsSection() {
<Text
size="sm"
fw={500}
- c="dark"
maw={200}
style={{
overflow: 'hidden',
diff --git a/testing/cucumber/features/steps/step_definitions.py b/testing/cucumber/features/steps/step_definitions.py
index e2210f4f4f..8f99ab89c1 100644
--- a/testing/cucumber/features/steps/step_definitions.py
+++ b/testing/cucumber/features/steps/step_definitions.py
@@ -298,7 +298,7 @@ def save_generated_pdf(context, filename):
def step_send_get_request(context, endpoint):
base_url = "http://localhost:8080"
full_url = f"{base_url}{endpoint}"
- response = requests.get(full_url, headers=API_HEADERS)
+ response = requests.get(full_url, headers=API_HEADERS, timeout=60)
context.response = response
@@ -307,7 +307,7 @@ def step_send_get_request_with_params(context, endpoint):
base_url = "http://localhost:8080"
params = {row["parameter"]: row["value"] for row in context.table}
full_url = f"{base_url}{endpoint}"
- response = requests.get(full_url, params=params, headers=API_HEADERS)
+ response = requests.get(full_url, params=params, headers=API_HEADERS, timeout=60)
context.response = response
@@ -337,7 +337,9 @@ def step_send_api_request(context, endpoint):
print(f"form_data {file.name} with {mime_type}")
form_data.append((key, (file.name, file, mime_type)))
- response = requests.post(url, files=form_data, headers=API_HEADERS)
+ # Set timeout to 300 seconds (5 minutes) to prevent infinite hangs
+ print(f"Sending POST request to {endpoint} with timeout=300s")
+ response = requests.post(url, files=form_data, headers=API_HEADERS, timeout=300)
context.response = response