From b76d797f77234bc364d958812bf0f428b666f539 Mon Sep 17 00:00:00 2001 From: Can Date: Mon, 16 Feb 2026 15:24:01 +0100 Subject: [PATCH] Fix folder string bug --- .../iste/meitrex/common/ollama/OllamaClient.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/unistuttgart/iste/meitrex/common/ollama/OllamaClient.java b/src/main/java/de/unistuttgart/iste/meitrex/common/ollama/OllamaClient.java index c53f7ef..097fde0 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/common/ollama/OllamaClient.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/common/ollama/OllamaClient.java @@ -41,7 +41,14 @@ public class OllamaClient { * @throws RuntimeException if the file is not found or cannot be read */ public String getTemplate(final String templateFileName) { - final String path = config.getPromptFolder() + "/" + templateFileName; + final String folder = config.getPromptFolder(); + final String sanitizedFolder = folder.startsWith("/") ? folder : "/" + folder; + + final String path = sanitizedFolder.endsWith("/") + ? sanitizedFolder + templateFileName + : sanitizedFolder + "/" + templateFileName; + + log.debug("Attempting to load template from path: {}", path); try (InputStream inputStream = this.getClass().getResourceAsStream(path)) { if (inputStream == null) {