From fb38a20465e3a6ae8413a4d30152261131ad814d Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Sun, 10 Apr 2022 13:49:32 +0200 Subject: [PATCH] Fix path separator in replay name Would probably have been caught by the write check as well, except in the specific case where the folder exists, e.g. `../` --- src/main/java/com/replaymod/core/utils/Utils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/replaymod/core/utils/Utils.java b/src/main/java/com/replaymod/core/utils/Utils.java index 39634262..1b518534 100644 --- a/src/main/java/com/replaymod/core/utils/Utils.java +++ b/src/main/java/com/replaymod/core/utils/Utils.java @@ -186,6 +186,10 @@ public class Utils { * Checks whether a given file name is actually usable with the file system / operating system at the given folder. */ private static boolean isUsable(Path folder, String fileName) { + if (fileName.contains(folder.getFileSystem().getSeparator())) { + return false; // file name contains the name separator, definitely not usable + } + Path path; try { path = folder.resolve(fileName);