diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py
index e5330b09c3e..dc32ee3a818 100644
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -95,6 +95,7 @@ class ToolParameter(Dictifiable):
self.name = self.__class__.parse_name(input_source)
self.type = input_source.get("type")
self.hidden = input_source.get_bool("hidden", False)
+ self.load_contents = int(input_source.get("load_contents", 0))
self.refresh_on_change = input_source.get_bool("refresh_on_change", False)
self.optional = input_source.parse_optional()
self.is_dynamic = False
diff --git a/lib/galaxy/tools/parameters/wrapped_json.py b/lib/galaxy/tools/parameters/wrapped_json.py
index f9c90d4abe1..73d019cdedc 100644
--- a/lib/galaxy/tools/parameters/wrapped_json.py
+++ b/lib/galaxy/tools/parameters/wrapped_json.py
@@ -66,7 +66,11 @@ def _json_wrap_input(input, value, handle_files="skip"):
if value:
if isinstance(value, list):
value = value[0]
- return _hda_to_object(value)
+ json_value = _hda_to_object(value)
+ if input.load_contents:
+ with open(str(value), mode='rb') as fh:
+ json_value['contents'] = fh.read(input.load_contents).decode('utf-8', errors='replace')
+ return json_value
else:
return None
else:
diff --git a/lib/galaxy/tools/parser/xml.py b/lib/galaxy/tools/parser/xml.py
index c142c97745d..7343517fed3 100644
--- a/lib/galaxy/tools/parser/xml.py
+++ b/lib/galaxy/tools/parser/xml.py
@@ -113,7 +113,7 @@ class XmlToolSource(ToolSource):
return ((command_el is not None) and command_el.text) or None
def parse_expression(self):
- """ Return string contianing command to run.
+ """ Return string containing command to run.
"""
expression_el = self.root.find("expression")
if expression_el is not None:
diff --git a/lib/galaxy/tools/xsd/galaxy.xsd b/lib/galaxy/tools/xsd/galaxy.xsd
index 7713c7bb614..86eb7bbec48 100644
--- a/lib/galaxy/tools/xsd/galaxy.xsd
+++ b/lib/galaxy/tools/xsd/galaxy.xsd
@@ -2098,7 +2098,7 @@ parameter being described. All the attributes for the ``param`` element are
documented below for completeness, but here are the common ones for each
type are as follows:
-$attribute_list:name,type,optional,label,help,argument,refresh_on_change:4
+$attribute_list:name,type,optional,label,help,argument,load_contents:refresh_on_change:4
### Parameter Types
@@ -2364,6 +2364,13 @@ tool form just below the associated field to provide information about the
field.
+
+
+ Number of bytes that should be
+loaded into the `contents` attribute of the jobs dictionary provided to Expression
+Tools. Applies only to type="data" inputs.
+
+
The default value for this