From e8555f79921caf74b136e161331972cb674f14d9 Mon Sep 17 00:00:00 2001 From: Thibaut Valentin Date: Wed, 18 Mar 2026 11:06:40 +0100 Subject: [PATCH] fix: add more log for file copy --- src/main/java/fr/titionfire/ffsaf/utils/Utils.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/titionfire/ffsaf/utils/Utils.java b/src/main/java/fr/titionfire/ffsaf/utils/Utils.java index d011d85..68e1e27 100644 --- a/src/main/java/fr/titionfire/ffsaf/utils/Utils.java +++ b/src/main/java/fr/titionfire/ffsaf/utils/Utils.java @@ -226,6 +226,8 @@ public class Utils { "THREAT_DETECTED on File " + file.fileName() + " is infected: " + result.getMessage()); } } + File f = file.filePath().toFile(); + System.out.println(f.exists() + " - " + f); // File is clean - now we can safely process it LOGGER.infof("File is clean: %s (size=%d) (contentType=%s)", file.fileName(), file.size(), @@ -244,14 +246,14 @@ public class Utils { FilenameFilter filter = (directory, filename) -> filename.startsWith(id + "."); File[] files = dirFile.listFiles(filter); if (files != null) { - for (File f : files) { + for (File f2 : files) { //noinspection ResultOfMethodCallIgnored - f.delete(); + f2.delete(); } } - File f = file.filePath().toFile(); - System.out.println(f + " -> " + new File(dirFile, id + "." + detectedExtensions[0])); + System.out.println( + f.exists() + " - " + f + " -> " + new File(dirFile, id + "." + detectedExtensions[0])); //noinspection ResultOfMethodCallIgnored System.out.println(f.renameTo(new File(dirFile, id + "." + detectedExtensions[0]))); return "ok"; -- 2.49.0