From b57f7f74d0195f5dc024d09654068892b33a13e0 Mon Sep 17 00:00:00 2001 From: Cristian Goina Date: Mon, 20 May 2024 16:41:43 -0400 Subject: [PATCH] use realpath when creating filedata from components --- .../java/org/janelia/colormipsearch/model/FileData.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/FileData.java b/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/FileData.java index 7628645c..118fa3b6 100644 --- a/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/FileData.java +++ b/colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/FileData.java @@ -1,5 +1,6 @@ package org.janelia.colormipsearch.model; +import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; @@ -34,7 +35,12 @@ public static FileData fromString(String fn) { } public static FileData fromComponents(FileDataType fileDataType, String parent, String name, boolean normalize) { - Path parentFilePath = Paths.get(parent).toAbsolutePath().normalize(); + Path parentFilePath; + try { + parentFilePath = Paths.get(parent).toRealPath(); + } catch (IOException e) { + parentFilePath = Paths.get(parent).toAbsolutePath().normalize(); + } if (fileDataType == FileDataType.zipEntry) { FileData fd = new FileData(); fd.setDataType(FileDataType.zipEntry);