mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #6418 from jmchilton/empty_file_behavior_fixes
Fixes for uploading empty files to Galaxy.
This commit is contained in:
@@ -393,8 +393,10 @@ class Ms2(Text):
|
||||
header_lines = []
|
||||
while True:
|
||||
line = contents.readline()
|
||||
if line is None or len(line) == 0:
|
||||
pass
|
||||
if not line:
|
||||
return False
|
||||
if line.strip() == "":
|
||||
continue
|
||||
elif line.startswith('H\t'):
|
||||
header_lines.append(line)
|
||||
else:
|
||||
|
||||
@@ -290,6 +290,9 @@ def guess_ext(fname, sniff_order, is_binary=False):
|
||||
>>> from galaxy.datatypes.registry import example_datatype_registry_for_sample
|
||||
>>> datatypes_registry = example_datatype_registry_for_sample()
|
||||
>>> sniff_order = datatypes_registry.sniff_order
|
||||
>>> fname = get_test_fname('empty.txt')
|
||||
>>> guess_ext(fname, sniff_order)
|
||||
'txt'
|
||||
>>> fname = get_test_fname('megablast_xml_parser_test1.blastxml')
|
||||
>>> guess_ext(fname, sniff_order)
|
||||
'blastxml'
|
||||
|
||||
@@ -108,7 +108,7 @@ def add_file(dataset, registry, output_path):
|
||||
if not os.path.exists(dataset.path):
|
||||
raise UploadProblemException('Uploaded temporary file (%s) does not exist.' % dataset.path)
|
||||
|
||||
if not os.path.getsize(dataset.path) > 0:
|
||||
if check_content and not os.path.getsize(dataset.path) > 0:
|
||||
raise UploadProblemException('The uploaded file is empty')
|
||||
|
||||
stdout, ext, datatype, is_binary, converted_path = handle_upload(
|
||||
|
||||
Reference in New Issue
Block a user