From 0ae033d14f62c249408f0b6fe7c115a485bc63b2 Mon Sep 17 00:00:00 2001 From: lum Date: Fri, 8 Nov 2024 14:15:59 -0800 Subject: [PATCH] 51629: On a windows system, transform scripts with backslashes should be handled better --- api/src/org/labkey/api/qc/TsvDataSerializer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/org/labkey/api/qc/TsvDataSerializer.java b/api/src/org/labkey/api/qc/TsvDataSerializer.java index 101705f69ca..88e3934861f 100644 --- a/api/src/org/labkey/api/qc/TsvDataSerializer.java +++ b/api/src/org/labkey/api/qc/TsvDataSerializer.java @@ -122,7 +122,14 @@ else if (Collection.class.isAssignableFrom(o.getClass())) else if (Object[].class.isAssignableFrom(o.getClass())) pw.append(StringUtils.join((Object[]) o, ",")); else - pw.append(String.valueOf(o)); + { + String val = String.valueOf(o); + // double quote the value if it contains backslashes to avoid tab loader mangling + // on import + if (val.contains("\\")) + val = "\"" + val + "\""; + pw.append(val); + } } sep = "\t"; }