diff --git a/lib/galaxy/web/security/__init__.py b/lib/galaxy/web/security/__init__.py index 29726ee6ea99..4a2ed331a97a 100644 --- a/lib/galaxy/web/security/__init__.py +++ b/lib/galaxy/web/security/__init__.py @@ -54,13 +54,13 @@ def encode_id( self, obj_id, kind=None ): # Encrypt return id_cipher.encrypt( s ).encode( 'hex' ) - def encode_dict_ids( self, a_dict, kind=None ): + def encode_dict_ids( self, a_dict, kind=None, skip_startswith=None ): """ Encode all ids in dictionary. Ids are identified by (a) an 'id' key or (b) a key that ends with '_id' """ for key, val in a_dict.items(): - if key == 'id' or key.endswith('_id'): + if key == 'id' or key.endswith('_id') and ( skip_startswith is None or not key.startswith( skip_startswith ) ): a_dict[ key ] = self.encode_id( val, kind=kind ) return a_dict diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 7ee0ab55fbcc..e3a7c168f54c 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -278,7 +278,7 @@ def create( self, trans, payload, **kwd ): # so it's possible to figure out which newly created elements # correspond with which tool file outputs output_dict[ 'output_name' ] = output_name - outputs.append( trans.security.encode_dict_ids( output_dict ) ) + outputs.append( trans.security.encode_dict_ids( output_dict, skip_startswith="metadata_" ) ) for job in vars.get('jobs', []): rval[ 'jobs' ].append( self.encode_all_ids( trans, job.to_dict( view='collection' ), recursive=True ) )