Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/galaxy/web/framework/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
from galaxy.util import (
parse_non_hex_float,
smart_str,
unicodify,
)
from galaxy.util.json import safe_dumps
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/web/framework/middleware/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __next__(self):
if not self.start_checker.response_started:
self.start_checker("500 Internal Server Error", [("content-type", "text/html")], exc_info)

return response
return response.encode("utf-8", errors="ignore")

def close(self):
# This should at least print something to stderr if the
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/web/framework/middleware/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def run_app():
prof = cProfile.Profile()
prof.runctx("run_app()", globals(), locals())
# Build up body with stats
body = "".join(body)
body = b"".join(body)
headers = catch_response[1]
content_type = response.header_value(headers, "content-type")
if not content_type.startswith("text/html"):
Expand All @@ -77,7 +77,7 @@ def run_app():
stats.strip_dirs()
stats.sort_stats("time", "calls")
output = pstats_as_html(stats, self.limit)
body += template % output
body += (template % output).encode("utf-8")
return [body]


Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/web/framework/middleware/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __call__(self, environ, start_response):
headers: list[tuple[str, str]] = []
ETAG.update(headers, mytime)
start_response("304 Not Modified", headers)
return [""] # empty body
return [b""] # empty body
app = FileApp(full)
if self.cache_seconds:
app.cache_control(max_age=int(self.cache_seconds))
Expand Down
Loading