Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/src/org/labkey/api/reader/TabLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.labkey.api.dataiterator.HashDataIterator;
import org.labkey.api.iterator.BeanIterator;
import org.labkey.api.iterator.CloseableIterator;
import org.labkey.api.settings.AppProps;
import org.labkey.api.util.FileType;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.JunitUtil;
Expand Down Expand Up @@ -67,6 +68,8 @@
*/
public class TabLoader extends DataLoader
{
public static final String FEATUREFLAG_UNESCAPE_BACKSLASH = "dataloader-unescape-backslashes";

public static final FileType TSV_FILE_TYPE = new TabFileType(Arrays.asList(".tsv", ".txt"), ".tsv", "text/tab-separated-values");
public static final FileType CSV_FILE_TYPE = new TabFileType(Collections.singletonList(".csv"), ".csv", "text/comma-separated-values");

Expand Down Expand Up @@ -200,7 +203,7 @@ public FileType getFileType()

private boolean _parseQuotes = true;
private boolean _parseEnclosedQuotes = false; // only treat quote as quote if it comes in pairs, otherwise treat it as a regular character
private boolean _unescapeBackslashes = true;
private boolean _unescapeBackslashes = AppProps.getInstance().isOptionalFeatureEnabled(FEATUREFLAG_UNESCAPE_BACKSLASH);

// Infer whether there are headers
public TabLoader(File inputFile)
Expand Down
5 changes: 5 additions & 0 deletions core/src/org/labkey/core/CoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ public QuerySchema createSchema(DefaultSchema schema, Module module)
"Resolve Missing Lookup Values to Null",
"When Lookup Validation for a field is not selected and lookup by alternate key is enabled, resolves missing lookup values to null instead of throwing an error. This option will be removed in LabKey Server v25.11.",
false, false, OptionalFeatureService.FeatureType.Deprecated));
OptionalFeatureService.get().addFeatureFlag(new OptionalFeatureFlag(TabLoader.FEATUREFLAG_UNESCAPE_BACKSLASH,
"Unescape backslash character on import",
"Treat backslash '\\' character as an escape character when loading data from file.",
false, false, OptionalFeatureService.FeatureType.Deprecated));


SiteValidationService svc = SiteValidationService.get();
if (null != svc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void testFileField() throws IOException, CommandException

private void importFilePathError(String participantId, String sequenceNum, String filePath)
{
String pasteData = TestDataUtils.tsvStringFromRowMapsEscapeBackslash(List.of(
String pasteData = TestDataUtils.tsvStringFromRowMaps(List.of(
Map.of("ParticipantId", participantId, "SequenceNum", sequenceNum, FILE_FIELD_1, filePath)),
List.of("ParticipantId", "SequenceNum", FILE_FIELD_1), true);
setFormElement(Locator.name("text"), pasteData);
Expand Down