mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-21 23:15:03 +00:00
fix: show error for PDFs without chapters
This commit is contained in:
parent
631c4fef0b
commit
a611ea5109
@ -131,7 +131,7 @@ public class SplitPdfByChaptersController {
|
|||||||
Integer bookmarkLevel =
|
Integer bookmarkLevel =
|
||||||
request.getBookmarkLevel(); // levels start from 0 (top most bookmarks)
|
request.getBookmarkLevel(); // levels start from 0 (top most bookmarks)
|
||||||
if (bookmarkLevel < 0) {
|
if (bookmarkLevel < 0) {
|
||||||
return ResponseEntity.badRequest().body("Invalid bookmark level".getBytes());
|
throw new IllegalArgumentException("Invalid bookmark level");
|
||||||
}
|
}
|
||||||
sourceDocument = pdfDocumentFactory.load(file);
|
sourceDocument = pdfDocumentFactory.load(file);
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public class SplitPdfByChaptersController {
|
|||||||
|
|
||||||
if (outline == null) {
|
if (outline == null) {
|
||||||
log.warn("No outline found for {}", file.getOriginalFilename());
|
log.warn("No outline found for {}", file.getOriginalFilename());
|
||||||
return ResponseEntity.badRequest().body("No outline found".getBytes());
|
throw new IllegalArgumentException("No outline found");
|
||||||
}
|
}
|
||||||
List<Bookmark> bookmarks = new ArrayList<>();
|
List<Bookmark> bookmarks = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user