1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/98694eecdf76/ Changeset: 98694eecdf76 User: dan Date: 2013-12-11 16:58:48 Summary: Add a redirect for Data Source tools, with the goal of subverting mix-mode content blocking in browsers, i.e. accessing http data source from an https Galaxy. Tested as working on Safari 7.0 and FireFox 26. Subverting did not work on Chrome 31. Affected #: 2 files diff -r 35ae5ce8be84dcccadaf58c9b569fb9cf9daccbf -r 98694eecdf76e7d69c77a0743d2b65fcb1ae3c12 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -3003,10 +3003,10 @@ # Add link details. if link_details: # Add details for creating a hyperlink to the tool. - if not self.tool_type.startswith( 'data_source' ): - link = url_for( '/tool_runner', tool_id=self.id ) + if not isinstance( self, DataSourceTool ): + link = url_for( controller='tool_runner', tool_id=self.id ) else: - link = url_for( self.action, **self.get_static_param_values( trans ) ) + link = url_for( controller='tool_runner', action='data_source_redirect', tool_id=self.id ) # Basic information tool_dict.update( { 'link': link, diff -r 35ae5ce8be84dcccadaf58c9b569fb9cf9daccbf -r 98694eecdf76e7d69c77a0743d2b65fcb1ae3c12 lib/galaxy/webapps/galaxy/controllers/tool_runner.py --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -6,6 +6,7 @@ import galaxy.util from galaxy import web from galaxy.tools import DefaultToolState +from galaxy.tools import DataSourceTool from galaxy.tools.actions import upload_common from galaxy.tools.parameters import params_to_incoming from galaxy.tools.parameters import visit_input_values @@ -233,6 +234,35 @@ **vars ) @web.expose + def data_source_redirect( self, trans, tool_id=None ): + """ + Redirects a user accessing a Data Source tool to its target action link. + This method will subvert mix-mode content blocking in several browsers when + accessing non-https data_source tools from an https galaxy server. + + Tested as working on Safari 7.0 and FireFox 26 + Subverting did not work on Chrome 31 + """ + if tool_id is None: + return trans.response.send_redirect( url_for( controller="root", action="welcome" ) ) + tool_version_select_field, tools, tool = self.__get_tool_components( tool_id, + tool_version=None, + get_loaded_tools_by_lineage=False, + set_selected=False ) + # No tool matching the tool id, display an error (shouldn't happen) + if not tool: + log.error( "data_source_redirect called with tool id '%s' but no such tool exists", tool_id ) + trans.log_event( "Tool id '%s' does not exist" % tool_id ) + trans.response.status = 404 + return "Tool '%s' does not exist, kwd=%s " % ( tool_id, kwd ) + + if isinstance( tool, DataSourceTool ): + link = url_for( tool.action, **tool.get_static_param_values( trans ) ) + else: + link = url_for( controller='tool_runner', tool_id=tool.id ) + return trans.response.send_redirect( link ) + + @web.expose def redirect( self, trans, redirect_url=None, **kwd ): if not redirect_url: return trans.show_error_message( "Required URL for redirection missing" ) 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.