From f63904b7209a3f4d800d7a59a508678a3286f61d Mon Sep 17 00:00:00 2001 From: Alex Lyttle <43786145+alexlyttle@users.noreply.github.com> Date: Tue, 3 Dec 2024 08:20:35 +0000 Subject: [PATCH] Fix TestSuiteResolver parse path containing "@" symbol (#266) * Fix issue by using last occurrence of '@' symbol * Improve fix to only check filename for @ symbol --------- Co-authored-by: Lukas Forer --- .../com/askimed/nf/test/core/TestSuiteResolver.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/askimed/nf/test/core/TestSuiteResolver.java b/src/main/java/com/askimed/nf/test/core/TestSuiteResolver.java index 6de32991..6af66995 100644 --- a/src/main/java/com/askimed/nf/test/core/TestSuiteResolver.java +++ b/src/main/java/com/askimed/nf/test/core/TestSuiteResolver.java @@ -3,6 +3,8 @@ import com.askimed.nf.test.lang.TestSuiteBuilder; import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.List; import java.util.Vector; @@ -24,9 +26,13 @@ public List parse(List scripts, TagQuery tagQuery) throws Thro for (File script : scripts) { String testId = null; - if (script.getAbsolutePath().contains("@")) { - String[] tiles = script.getAbsolutePath().split("@"); - script = new File(tiles[0]); + Path path = Paths.get(script.getAbsolutePath()); + String fileName = path.getFileName().toString(); + + if (fileName.contains("@")) { + String[] tiles = fileName.split("@"); + String basePath = path.getParent().toString(); + script = new File(Paths.get(basePath, tiles[0]).toString()); testId = tiles[1]; } if (!script.exists()) {