mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
✨ (Snyk) Fixed finding: "java/PT"
This commit is contained in:
parent
fc9551a332
commit
fcb8085788
@ -7,6 +7,7 @@ import java.awt.print.Printable;
|
|||||||
import java.awt.print.PrinterException;
|
import java.awt.print.PrinterException;
|
||||||
import java.awt.print.PrinterJob;
|
import java.awt.print.PrinterJob;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@ -45,6 +46,10 @@ public class PrintFileController {
|
|||||||
public ResponseEntity<String> printFile(@ModelAttribute PrintFileRequest request)
|
public ResponseEntity<String> printFile(@ModelAttribute PrintFileRequest request)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
MultipartFile file = request.getFileInput();
|
MultipartFile file = request.getFileInput();
|
||||||
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
if (originalFilename != null && (originalFilename.contains("..") || Paths.get(originalFilename).isAbsolute())) {
|
||||||
|
throw new IOException("Invalid file path detected: " + originalFilename);
|
||||||
|
}
|
||||||
String printerName = request.getPrinterName();
|
String printerName = request.getPrinterName();
|
||||||
String contentType = file.getContentType();
|
String contentType = file.getContentType();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user