Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset content-length for unhandled exceptions
This prevents `ProtocolError` caused by the error middleware not being able to reset the content length. Only affects routes that explicitly set the content-length and don't have a default response handler. This is effectively the case when using `web.expose`. To test this, make sure you get Galaxy's error middleware output in the browser and your console. ``` diff --git a/lib/galaxy/webapps/galaxy/controllers/dataset.py b/lib/galaxy/webapps/galaxy/controllers/dataset.py index c95d9df788..92b04684d3 100644 --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -456,6 +456,8 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE def imp(self, trans, dataset_id=None, **kwd): """Import another user's dataset via a shared URL; dataset is added to user's current history.""" # Set referer message. + trans.response.headers["content-length"] = 0 + trans = None referer = trans.request.referer if referer and not referer.startswith(f"{trans.request.application_url}{url_for('/login')}"): referer_message = f"<a href='{escape(referer)}'>return to the previous page</a>" ```
- Loading branch information