diff --git a/main/src/com/google/refine/importing/ImportingUtilities.java b/main/src/com/google/refine/importing/ImportingUtilities.java index 721e223b4..d0b76a3cf 100644 --- a/main/src/com/google/refine/importing/ImportingUtilities.java +++ b/main/src/com/google/refine/importing/ImportingUtilities.java @@ -666,7 +666,8 @@ public class ImportingUtilities { } }); - String bestFormat = formats.size() > 0 ? formats.get(0) : null; + // Default to text/line-based to to avoid parsing as binary/excel. + String bestFormat = formats.size() > 0 ? formats.get(0) : "text/line-based"; if (JSONUtilities.getInt(retrievalRecord, "archiveCount", 0) == 0) { // If there's no archive, then select everything for (int i = 0; i < count; i++) { @@ -681,6 +682,14 @@ public class ImportingUtilities { JSONUtilities.append(fileSelectionIndexes, i); } } + + // If nothing matches the best format but we have some files, + // then select them all + if (fileSelectionIndexes.length() == 0 && count > 0) { + for (int i = 0; i < count; i++) { + JSONUtilities.append(fileSelectionIndexes, i); + } + } } return bestFormat; }