fix(SplitPDF): create immutable list for dynamic additions (#877)
This commit is contained in:
parent
731dc3f3dc
commit
2f703796e9
4 changed files with 10 additions and 4 deletions
|
@ -51,8 +51,12 @@ public class SplitPDFController {
|
||||||
PDDocument document = Loader.loadPDF(file.getBytes());
|
PDDocument document = Loader.loadPDF(file.getBytes());
|
||||||
|
|
||||||
List<Integer> pageNumbers = request.getPageNumbersList(document, true);
|
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);
|
pageNumbers.add(document.getNumberOfPages() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"Splitting PDF into pages: {}",
|
"Splitting PDF into pages: {}",
|
||||||
pageNumbers.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
pageNumbers.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||||
|
|
|
@ -155,5 +155,4 @@ public class SplitPdfBySectionsController {
|
||||||
|
|
||||||
return splitDocuments;
|
return splitDocuments;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,6 @@ public class ApplicationProperties {
|
||||||
+ enableAlphaFunctionality
|
+ enableAlphaFunctionality
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Ui {
|
public static class Ui {
|
||||||
|
|
|
@ -20,7 +20,11 @@ public enum Role {
|
||||||
// 0 API calls per day and 20 web calls
|
// 0 API calls per day and 20 web calls
|
||||||
WEB_ONLY_USER("ROLE_WEB_ONLY_USER", 0, 20, "adminUserSettings.webOnlyUser"),
|
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");
|
DEMO_USER("ROLE_DEMO_USER", 100, 100, "adminUserSettings.demoUser");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue