mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix legacy_expose_api error callable returning str instead of bytes
The error inner function was used as a WSGI sub-application but returned a bare string. WSGI requires response bodies to be iterables of byte strings. With a2wsgi converting to ASGI, h11 rejects the str, causing a TypeError in starlette's BaseHTTPMiddleware.
This commit is contained in:
@@ -20,6 +20,7 @@ from galaxy.exceptions.utils import (
|
||||
)
|
||||
from galaxy.util import (
|
||||
parse_non_hex_float,
|
||||
smart_str,
|
||||
unicodify,
|
||||
)
|
||||
from galaxy.util.json import safe_dumps
|
||||
@@ -154,7 +155,7 @@ def legacy_expose_api(func, to_json=True, user_required=True):
|
||||
def decorator(self, trans, *args, **kwargs):
|
||||
def error(environ, start_response):
|
||||
start_response(error_status, [("Content-type", "text/plain")])
|
||||
return error_message
|
||||
return [smart_str(error_message)]
|
||||
|
||||
error_status = "403 Forbidden"
|
||||
if trans.error_message:
|
||||
|
||||
Reference in New Issue
Block a user