From c30b7838cc53b7f91c2bed44e1f1d7f0895bfffc Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 2 Jun 2014 13:16:15 -0400 Subject: [PATCH] Fix for when check_binary fails against an actual binary datatype. The logic in upload needs to be revisited per the comments. --- tools/data_source/upload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 8d7b8edf1c6..4d5a0a1ff90 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -241,7 +241,11 @@ def add_file( dataset, registry, json_file, output_path ): dataset.name = uncompressed_name data_type = 'zip' if not data_type: - if check_binary( dataset.path ): + # TODO refactor this logic. check_binary isn't guaranteed to be + # correct since it only looks at whether the first 100 chars are + # printable or not. If someone specifies a known unsniffable + # binary datatype and check_binary fails, the file gets mangled. + if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type): # We have a binary dataset, but it is not Bam, Sff or Pdf data_type = 'binary' #binary_ok = False