1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-04 23:10:11 +01:00

fix(SplitPDF): create immutable list for dynamic additions (#877)

This commit is contained in:
Eric 2024-03-07 12:05:26 -05:00 committed by GitHub
parent 731dc3f3dc
commit 2f703796e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 4 deletions

View File

@ -51,8 +51,12 @@ public class SplitPDFController {
PDDocument document = Loader.loadPDF(file.getBytes());
List<Integer> pageNumbers = request.getPageNumbersList(document, true);
if (!pageNumbers.contains(document.getNumberOfPages() - 1))
if (!pageNumbers.contains(document.getNumberOfPages() - 1)) {
// Create a mutable ArrayList so we can add to it
pageNumbers = new ArrayList<>(pageNumbers);
pageNumbers.add(document.getNumberOfPages() - 1);
}
logger.info(
"Splitting PDF into pages: {}",
pageNumbers.stream().map(String::valueOf).collect(Collectors.joining(",")));

View File

@ -155,5 +155,4 @@ public class SplitPdfBySectionsController {
return splitDocuments;
}
}

View File

@ -277,7 +277,6 @@ public class ApplicationProperties {
+ enableAlphaFunctionality
+ "]";
}
}
public static class Ui {

View File

@ -20,7 +20,11 @@ public enum Role {
// 0 API calls per day and 20 web calls
WEB_ONLY_USER("ROLE_WEB_ONLY_USER", 0, 20, "adminUserSettings.webOnlyUser"),
INTERNAL_API_USER("STIRLING-PDF-BACKEND-API-USER", Integer.MAX_VALUE, Integer.MAX_VALUE, "adminUserSettings.internalApiUser"),
INTERNAL_API_USER(
"STIRLING-PDF-BACKEND-API-USER",
Integer.MAX_VALUE,
Integer.MAX_VALUE,
"adminUserSettings.internalApiUser"),
DEMO_USER("ROLE_DEMO_USER", 100, 100, "adminUserSettings.demoUser");