From 961812bad0ac2bfa3cb31dc38ffcf94d06e31231 Mon Sep 17 00:00:00 2001 From: Jiri Kuchynka Date: Fri, 29 Nov 2024 09:40:29 +0100 Subject: [PATCH] fix: use file name instead of whole path for language guess (#2734) Namespaces are allowed to contain dots (`.`). Exporting projects with such namespaces will result in directories for namespaces containing dots. The current implementation assumes the first dot-separated section to be language and guesses the language incorrectly. --- .../src/main/kotlin/io/tolgee/formats/ImportFileProcessor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/data/src/main/kotlin/io/tolgee/formats/ImportFileProcessor.kt b/backend/data/src/main/kotlin/io/tolgee/formats/ImportFileProcessor.kt index d6f4d3dff0..e365a6e0bd 100644 --- a/backend/data/src/main/kotlin/io/tolgee/formats/ImportFileProcessor.kt +++ b/backend/data/src/main/kotlin/io/tolgee/formats/ImportFileProcessor.kt @@ -8,7 +8,9 @@ abstract class ImportFileProcessor { abstract fun process() val languageNameGuesses: List by lazy { - val fileName = context.file.name + val filePath = context.file.name + + val fileName = filePath.substringAfterLast("/") val result = arrayOf(