commit/galaxy-central: jgoecks: When exporting a history archive, use user dataset names rather than Galaxy dataset names. Fixes #680
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/effb888d61e1/ changeset: effb888d61e1 user: jgoecks date: 2011-12-01 16:22:46 summary: When exporting a history archive, use user dataset names rather than Galaxy dataset names. Fixes #680 affected #: 1 file diff -r a2ae1bb435378eefc659941b790ec15f3a0a8584 -r effb888d61e1214ac57222bee419ac378fed606f lib/galaxy/tools/imp_exp/export_history.py --- a/lib/galaxy/tools/imp_exp/export_history.py +++ b/lib/galaxy/tools/imp_exp/export_history.py @@ -10,6 +10,14 @@ from galaxy.util.json import * import optparse, sys, os, tempfile, tarfile +def get_dataset_filename( name, ext ): + """ + Builds a filename for a dataset using its name an extension. + """ + valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + base = ''.join( c in valid_chars and c or '_' for c in name ) + return base + ".%s" % ext + def create_archive( history_attrs_file, datasets_attrs_file, jobs_attrs_file, out_file, gzip=False ): """ Create archive from the given attribute/metadata files and save it to out_file. """ tarfile_mode = "w" @@ -37,7 +45,8 @@ # TODO: security check to ensure that files added are in Galaxy dataset directory? for dataset_attrs in datasets_attrs: dataset_file_name = dataset_attrs[ 'file_name' ] # Full file name. - dataset_archive_name = os.path.join( "datasets", os.path.split( dataset_file_name )[-1] ) + dataset_archive_name = os.path.join( 'datasets', + get_dataset_filename( dataset_attrs[ 'name' ], dataset_attrs[ 'extension' ] ) ) history_archive.add( dataset_file_name, arcname=dataset_archive_name ) # Update dataset filename to be archive name. dataset_attrs[ 'file_name' ] = dataset_archive_name Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket