From 39a0c406b289931fc53c95ff1fd5d6a1064e6057 Mon Sep 17 00:00:00 2001 From: XingY Date: Sat, 13 Dec 2025 10:34:58 -0800 Subject: [PATCH] Do not relativize ExpData URIs when making the LSID unless under file root --- .../experiment/api/ExperimentServiceImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java index 9baee1183c3..dc6b729ac44 100644 --- a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java +++ b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java @@ -230,6 +230,7 @@ import org.labkey.api.util.StringUtilsLabKey; import org.labkey.api.util.SubstitutionFormat; import org.labkey.api.util.TestContext; +import org.labkey.api.util.URIUtil; import org.labkey.api.util.UnexpectedException; import org.labkey.api.util.logging.LogHelper; import org.labkey.api.view.ActionURL; @@ -774,7 +775,17 @@ public ExpDataImpl createData(URI uri, XarSource source) throws XarFormatExcepti { path = FileUtil.stringToPath(source.getXarContext().getContainer(), source.getCanonicalDataFileURL(FileUtil.pathToString(path))); - pathStr = FileUtil.relativizeUnix(source.getRootPath(), path, false); + + // Only convert to a relative path if this is a descendant of the root: + path = path.normalize(); + if (URIUtil.isDescendant(source.getRootPath().toUri(), path.toUri())) + { + pathStr = FileUtil.relativizeUnix(source.getRootPath(), path, false); + } + else + { + pathStr = FileUtil.pathToString(path); + } } catch (IOException e) {