From b36b229ba4d9ba290beb7706d04d77b9d0df8fd0 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Fri, 4 Nov 2011 22:33:38 +0000 Subject: [PATCH] Fixed Issue 465: Data text file with extension .dta within a .ZIP is not automatically extracted .dta isn't recognized so there's no best format detected. But now we default to text/line-based and always select all files if no file gets selected by default. git-svn-id: http://google-refine.googlecode.com/svn/trunk@2358 7d457c2a-affb-35e4-300a-418c747d4874 --- .../google/refine/importing/ImportingUtilities.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; }