Question: How do I save multi-line 'area' text input to a file in tool XML?
0
gravatar for mrals
4 months ago by
mrals0
mrals0 wrote:

Hello, I have a plain text input for some data. <param name="foo" type="text" area="True" label="This is Foo"/> I would like to paste the value of this cheetah variable into a file in the command block, something like echo $foo > input.txt; but when I do this, Cheetah replaces each newline of the text input with "__cn__" and each carrot with "__gt__". How do I load this data into a file without using regex?

tool xml dev • 103 views
ADD COMMENTlink modified 4 months ago by Hotz, Hans-Rudolf1.7k • written 4 months ago by mrals0
1
gravatar for Hotz, Hans-Rudolf
4 months ago by
Switzerland
Hotz, Hans-Rudolf1.7k wrote:

Hi

Special characters are sanitized for security purposes. See: ~/lib/galaxy/util/__init__.py for all the mapped characters.

Have a look at: https://docs.galaxyproject.org/en/latest/dev/schema.html#tool-inputs-param-sanitizer for ways to handle this on a per tool basis. However, keep in mind, that passing characters unsanitized is a potential security risk.

Hope this helps Regards, Hans-Rudolf

ADD COMMENTlink written 4 months ago by Hotz, Hans-Rudolf1.7k

Thank you @Hans-Rudolf. I understand the concern, which makes lots of sense in an open-source environment. In my case, the text was more of a config-file for parsing, rather than an executable script (like the awk example that is often featured).

Your link helped solve my problem, as the documentation on mapping helped me turn the newline character into a space, and then a simple echo $mytext | tr ' ' '\n' > $cfgfile statement allowed me to echo the text into the config file by replacing the space with a newline.

edit: tr was simpler than sed.

ADD REPLYlink modified 4 months ago • written 4 months ago by mrals0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 90 users visited in the last hour