Update app/core/src/main/java/stirling/software/SPDF/controller/api/misc/StampController.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Ludy 2025-08-02 14:18:20 +02:00 committed by GitHub
parent 3542da1b5a
commit e4421918bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,6 +71,9 @@ public class StampController {
String stampText = request.getStampText();
MultipartFile stampImage = request.getStampImage();
if ("image".equalsIgnoreCase(stampType)) {
if (stampImage == null) {
throw new IllegalArgumentException("Stamp image file must be provided when stamp type is 'image'");
}
String stampImageName = stampImage.getOriginalFilename();
if (stampImageName == null || stampImageName.contains("..") || stampImageName.startsWith("/")) {
throw new IllegalArgumentException("Invalid stamp image file path");