mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
catch sniffing exceptions in handle uploads
Co-authored-by: Nicola Soranzo <nicola.soranzo@earlham.ac.uk> Co-authored-by: Marius van den Beek <m.vandenbeek@gmail.com>
This commit is contained in:
co-authored by
Nicola Soranzo
Marius van den Beek
parent
8594b13036
commit
37a2edf00a
@@ -80,9 +80,13 @@ def handle_upload(
|
||||
if requested_ext != 'auto':
|
||||
datatype = registry.get_datatype_by_extension(requested_ext)
|
||||
# Enable sniffer "validate mode" (prevents certain sniffers from disabling themselves)
|
||||
if check_content and hasattr(datatype, 'sniff') and not datatype.sniff(path):
|
||||
stdout = ("Warning: The file 'Type' was set to '{ext}' but the file does not appear to be of that"
|
||||
" type".format(ext=requested_ext))
|
||||
if check_content and hasattr(datatype, 'sniff'):
|
||||
try:
|
||||
is_of_datatype = datatype.sniff(path)
|
||||
except Exception:
|
||||
is_of_datatype = False
|
||||
if not is_of_datatype:
|
||||
stdout = f"Warning: The file 'Type' was set to '{requested_ext}' but the file does not appear to be of that type"
|
||||
|
||||
# Handle unsniffable binaries
|
||||
if is_binary and ext == 'binary':
|
||||
|
||||
Reference in New Issue
Block a user