Modernize and secure temp file creation

This commit is contained in:
pixeebot[bot] 2024-02-10 00:08:18 +00:00
parent 68c0941666
commit 23672cd18d

View file

@ -54,7 +54,7 @@ public class FileToPdf {
if (request.getZoom() != 1.0) { if (request.getZoom() != 1.0) {
// Create a temporary CSS file // Create a temporary CSS file
File tempCssFile = File.createTempFile("customStyle", ".css"); File tempCssFile = Files.createTempFile("customStyle", ".css").toFile();
try (FileWriter writer = new FileWriter(tempCssFile)) { try (FileWriter writer = new FileWriter(tempCssFile)) {
// Write the CSS rule to the file // Write the CSS rule to the file
writer.write("body { zoom: " + request.getZoom() + "; }"); writer.write("body { zoom: " + request.getZoom() + "; }");