Skip to content

Commit

Permalink
fix sanitizing of slashes and add sanitizing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Delphine-L committed Jun 28, 2024
1 parent fbaac02 commit 6270c87
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions tools/data_export/export_remote.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,35 @@ python '$__tool_directory__/export_remote.py'
<configfile name="files_to_export">#import json
#from galaxy.util import filesystem_safe_string
#if $export_type.export_type_selector == "datasets_auto":
#set $fileconfig = json.dumps($export_type.infiles.serialize(invalid_chars=tuple(str($invalid_chars))))
#if $invalid_chars=="space":
#set $fileconfig = json.dumps($export_type.infiles.serialize(invalid_chars=tuple(str(" "))))
#else:
#set $fileconfig = json.dumps($export_type.infiles.serialize(invalid_chars=tuple(str($invalid_chars))))
#end if
#else if $export_type.export_type_selector == "collection_auto":
#set $fileconfig = json.dumps($export_type.incollection.serialize(invalid_chars=tuple(str($invalid_chars)), include_collection_name=bool($export_type.include_collection_name)))
#set $fileconfig = json.dumps($export_type.incollection.serialize(invalid_chars=tuple(str($invalid_chars)), include_collection_name=bool($export_type.include_collection_name)))

#if $invalid_chars=="space":
#set $fileconfig = json.dumps($export_type.incollection.serialize(invalid_chars=tuple(str(" ")), include_collection_name=bool($export_type.include_collection_name)))
#else:
#set $fileconfig = json.dumps($export_type.incollection.serialize(invalid_chars=tuple(str($invalid_chars)), include_collection_name=bool($export_type.include_collection_name)))
#end if

#else
#set $fileconfig = [d['infile'].serialize() for d in $export_type.datasets]
#for $i, $dataset in enumerate($export_type.datasets):
#silent $fileconfig[$i]['staging_path'] = filesystem_safe_string(str(dataset["name"]), 255, invalid_chars=())
#end for
#silent fileconfig = json.dumps($fileconfig)

#set $fileconfig = [d['infile'].serialize() for d in $export_type.datasets]
#if $invalid_chars=="space":
#for $i, $dataset in enumerate($export_type.datasets):
#silent $fileconfig[$i]['staging_path'] = filesystem_safe_string(str(dataset["name"]), 255, invalid_chars=[str(" ")])
#end for
#else:
#for $i, $dataset in enumerate($export_type.datasets):
#silent $fileconfig[$i]['staging_path'] = filesystem_safe_string(str(dataset["name"]), 255, invalid_chars=[str($invalid_chars)])
#end for
#end if

#silent fileconfig = json.dumps($fileconfig)

#end if
$fileconfig
</configfile>
Expand Down Expand Up @@ -61,6 +81,7 @@ $fileconfig
<param name="include_metadata_files" type="boolean" checked="true" label="Include metadata files in export?" help="Examples of metadata files are bam, cram and vcf indexes that can be regenerated from raw data" />
<param name="invalid_chars" type="select" label="Select which characters should be stripped from the exported paths">
<option value="/">Sanitize /</option>
<option value="space">Sanitize spaces</option>
<option value="">Don't sanitize values</option>
</param>
</inputs>
Expand Down

0 comments on commit 6270c87

Please sign in to comment.