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
This commit is contained in:
David Huynh 2011-11-04 22:33:38 +00:00
parent 41a90ad71f
commit b36b229ba4

View File

@ -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 (JSONUtilities.getInt(retrievalRecord, "archiveCount", 0) == 0) {
// If there's no archive, then select everything // If there's no archive, then select everything
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@ -681,6 +682,14 @@ public class ImportingUtilities {
JSONUtilities.append(fileSelectionIndexes, i); 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; return bestFormat;
} }