Unverified Commit ac3625eb authored by mvdbeek's avatar mvdbeek
Browse files

Check for app_name and link_name before unquoting

Should fix
https://sentry.galaxyproject.org/share/issue/f20a1d47fab04ca8bca7a657d81fb568/:
```
AttributeError: 'NoneType' object has no attribute 'replace'
  File "/cvmfs/main.galaxyproject.org/venv/lib/python3.8/site-packages/paste/recursive.py", line 85, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/middleware/statsd.py", line 29, in __call__
    req = self.application(environ, start_response)
  File "/cvmfs/main.galaxyproject.org/venv/lib/python3.8/site-packages/paste/httpexceptions.py", line 640, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/base.py", line 159, in __call__
    return self.handle_request(environ, start_response)
  File "galaxy/web/framework/base.py", line 244, in handle_request
    body = method(trans, **kwargs)
  File "galaxy/web/framework/decorators.py", line 138, in set_nocache_headers
    return func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 738, in display_application
    link_name = unquote_plus(link_name)
  File "urllib/parse.py", line 777, in unquote_plus
    string = string.replace('+', ' ')
```
parent 881ed5c7
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -702,6 +702,10 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
        **kwds,
    ):
        """Access to external display applications"""
        if None in [app_name, link_name]:
            return trans.show_error_message("A display application name and link name must be provided.")
        app_name = unquote_plus(app_name)
        link_name = unquote_plus(link_name)
        # Build list of parameters to pass in to display application logic (app_kwds)
        app_kwds = {}
        for name, value in dict(kwds).items():  # clone kwds because we remove stuff as we go.
@@ -723,10 +727,6 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
        else:
            user_roles = []
        # Decode application name and link name
        app_name = unquote_plus(app_name)
        link_name = unquote_plus(link_name)
        if None in [app_name, link_name]:
            return trans.show_error_message("A display application name and link name must be provided.")
        if self._can_access_dataset(trans, data, additional_roles=user_roles):
            msg = []
            preparable_steps = []