fix(epub): suppress FileNotFoundException for optional EPUB files

This commit is contained in:
acx10
2026-02-12 16:40:34 -07:00
parent 414b6d8d9e
commit 5e0de4d3eb

View File

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.HandlerMapping;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
@@ -67,6 +68,11 @@ public class EpubReaderController {
response.setHeader("Cache-Control", "public, max-age=3600");
epubReaderService.streamFile(bookId, bookType, filePath, response.getOutputStream());
try {
epubReaderService.streamFile(bookId, bookType, filePath, response.getOutputStream());
} catch (FileNotFoundException e) {
response.reset();
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
}