From 22cee5636ef45fa1d5926d4b2929d1cb9f0d284f Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Wed, 6 Sep 2023 17:32:44 +0300 Subject: [PATCH] feat: fix paths --- .../cli/commands/actions/ScreenshotUploadAction.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/ScreenshotUploadAction.java b/src/main/java/com/crowdin/cli/commands/actions/ScreenshotUploadAction.java index 74385fbc1..98b0c21b1 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/ScreenshotUploadAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/ScreenshotUploadAction.java @@ -7,6 +7,7 @@ import com.crowdin.cli.commands.NewAction; import com.crowdin.cli.commands.Outputter; import com.crowdin.cli.properties.ProjectProperties; +import com.crowdin.cli.utils.Utils; import com.crowdin.cli.utils.console.ConsoleSpinner; import com.crowdin.client.screenshots.model.AddScreenshotRequest; import com.crowdin.client.screenshots.model.Screenshot; @@ -75,14 +76,16 @@ public void act(Outputter out, ProjectProperties properties, ClientScreenshot cl request.setBranchId(branch.getId()); } if (nonNull(pathToSourceFile)) { + final String normalizedPath = Utils.unixPath(Utils.sepAtStart(pathToSourceFile)); FileInfo fileInfo = project.getFileInfos().stream() - .filter(f -> pathToSourceFile.equals(f.getPath())).findFirst() + .filter(f -> normalizedPath.equals(f.getPath())).findFirst() .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.file_not_exists"), pathToSourceFile))); request.setFileId(fileInfo.getId()); } if (nonNull(directoryPath)) { + final String normalizedPath = Utils.unixPath(Utils.sepAtStart(directoryPath)); Directory directory = project.getDirectories().values().stream() - .filter(d -> directoryPath.equals(d.getPath())).findFirst() + .filter(d -> normalizedPath.equals(d.getPath())).findFirst() .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.dir_not_exists"), directoryPath))); request.setDirectoryId(directory.getId()); }