commit/galaxy-central: greg: Set mimetype when displaying images in tool shed repositories.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/656b965c5d03/ Changeset: 656b965c5d03 User: greg Date: 2013-10-07 16:14:42 Summary: Set mimetype when displaying images in tool shed repositories. Affected #: 2 files diff -r 1dee9c665f38ff06e4fd77e90d0d62b2c080182a -r 656b965c5d030b7a6b61b727380a8141c12c2c37 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -305,6 +305,10 @@ repo_files_dir = repository.repo_files_directory( trans.app ) path_to_file = suc.get_absolute_path_to_file_in_repository( repo_files_dir, relative_path_to_image_file ) if os.path.exists( path_to_file ): + file_name = os.path.basename( relative_path_to_image_file ) + mimetype = trans.app.datatypes_registry.get_mimetype_by_extension( file_name, None ) + if mimetype: + trans.response.set_content_type( mimetype ) return open( path_to_file, 'r' ) return None diff -r 1dee9c665f38ff06e4fd77e90d0d62b2c080182a -r 656b965c5d030b7a6b61b727380a8141c12c2c37 lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1037,6 +1037,10 @@ repo_files_dir = repository.repo_path( trans.app ) path_to_file = suc.get_absolute_path_to_file_in_repository( repo_files_dir, relative_path_to_image_file ) if os.path.exists( path_to_file ): + file_name = os.path.basename( relative_path_to_image_file ) + mimetype = trans.app.datatypes_registry.get_mimetype_by_extension( file_name, None ) + if mimetype: + trans.response.set_content_type( mimetype ) return open( path_to_file, 'r' ) return None 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)
-
commits-noreply@bitbucket.org