mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #5613 from erasche/fix-fraking-grt
[18.01] File sizes not being annotated in GRT
This commit is contained in:
+13
-10
@@ -69,7 +69,7 @@ class Sanitization:
|
||||
self.sanitization_config['tool_params'] = {}
|
||||
|
||||
def blacklisted_tree(self, path):
|
||||
if path.lstrip('.') in self.sanitization_config['tool_params'][self.tool_id]:
|
||||
if self.tool_id in self.sanitization_config['tool_params'] and path.lstrip('.') in self.sanitization_config['tool_params'][self.tool_id]:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -79,21 +79,23 @@ class Sanitization:
|
||||
return 'null'
|
||||
# Thus, all tools below here are not blacklisted at the top level.
|
||||
|
||||
# If it isn't in tool_params, there are no keys being sanitized for
|
||||
# this tool so we can return quickly without parsing.
|
||||
if tool_id not in self.sanitization_config['tool_params']:
|
||||
return value
|
||||
|
||||
# If the key is listed precisely (not a sub-tree), we can also return slightly more quickly.
|
||||
if key in self.sanitization_config['tool_params'][tool_id]:
|
||||
if tool_id in self.sanitization_config['tool_params'] and key in self.sanitization_config['tool_params'][tool_id]:
|
||||
return 'null'
|
||||
|
||||
# If the key isn't a prefix for any of the keys being sanitized, then this is safe.
|
||||
if not any(san_key.startswith(key) for san_key in self.sanitization_config['tool_params'][tool_id]):
|
||||
if tool_id in self.sanitization_config['tool_params'] and not any(san_key.startswith(key) for san_key in self.sanitization_config['tool_params'][tool_id]):
|
||||
return value
|
||||
|
||||
# Slow path.
|
||||
unsanitized = {key: json.loads(value)}
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
unsanitized = {key: json.loads(value)}
|
||||
except ValueError:
|
||||
unsanitized = {key: value}
|
||||
else:
|
||||
unsanitized = {key: value}
|
||||
|
||||
self.tool_id = tool_id
|
||||
return json.dumps(self._sanitize_value(unsanitized))
|
||||
|
||||
@@ -117,7 +119,8 @@ class Sanitization:
|
||||
self.filesize_cache[data['id']] = data
|
||||
return data
|
||||
else:
|
||||
raise Exception("Cannot handle {src} yet".format(data))
|
||||
logging.warning("Cannot handle {src} yet".format(data))
|
||||
return data
|
||||
|
||||
def _sanitize_dict(self, unsanitized_dict, path=""):
|
||||
# if it is a file dictionary, handle specially.
|
||||
|
||||
Reference in New Issue
Block a user