commit/galaxy-central: greg: Handle errors when defining paths to images on disk for display in tool shed repositories.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/0ee4e7ac77e2/ Changeset: 0ee4e7ac77e2 User: greg Date: 2013-10-04 16:30:55 Summary: Handle errors when defining paths to images on disk for display in tool shed repositories. Affected #: 2 files diff -r 836b6a16e5a9e499c0a07b23b69c25a3f17eba98 -r 0ee4e7ac77e25a814e02157e3d5c77c43f4b224c 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 @@ -301,9 +301,11 @@ relative_path_to_image_file = kwd.get( 'image_file', None ) if repository_id and relative_path_to_image_file: repository = suc.get_tool_shed_repository_by_id( trans, repository_id ) - 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 ) - return open( path_to_file, 'r' ) + if repository: + 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 ): + return open( path_to_file, 'r' ) return None @web.expose diff -r 836b6a16e5a9e499c0a07b23b69c25a3f17eba98 -r 0ee4e7ac77e25a814e02157e3d5c77c43f4b224c 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 @@ -1033,9 +1033,11 @@ relative_path_to_image_file = kwd.get( 'image_file', None ) if repository_id and relative_path_to_image_file: repository = suc.get_repository_in_tool_shed( trans, repository_id ) - repo_files_dir = os.path.join( repository.repo_path( trans.app ), repository.name ) - path_to_file = suc.get_absolute_path_to_file_in_repository( repo_files_dir, relative_path_to_image_file ) - return open( path_to_file, 'r' ) + if repository: + 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 ): + return open( path_to_file, 'r' ) return None @web.expose 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