googlecolab / jupyter_http_over_ws

Apache License 2.0
267 stars 56 forks source link

api/session names are URL encoded and display incorrectly in a jupyter server #25

Open terencehonles opened 3 years ago

terencehonles commented 3 years ago

When connecting colab to a Jupyter server the frontend application sends URL encoded parameters to /api/sessions which causes the API to return hard to read names. While this is coming from the frontend, if the backend needs the URL encoding this can be undone in this package when forwarding the API request to the Jupyter server.

This can be seen by creating a notebook in drive with a character which needs to be escaped and looking at the websocket connections that are happening to the handler this package provides.

An example response from /api/sessions after loading such a notebook might be the following:

[
    {
        "id": "fa293a7e-afb2-4fca-92c2-ffb9e548e052",
        "kernel": {
            "connections": 0,
            "execution_state": "idle",
            "id": "0ece430d-e288-4907-973f-d58a6d8010ff",
            "last_activity": "2021-02-17T06:31:48.663580Z",
            "name": "Python"
        },
        "name": "%5Btest%5D%20example%20notebook.ipynb",
        "notebook": {
            "name": "%5Btest%5D%20example%20notebook.ipynb",
            "path": "fileId=?????????????????????????????????"
        },
        "path": "fileId=?????????????????????????????????",
        "type": "notebook"
    }
]

While the expected response would instead include the string [test] example notebook.ipynb.

terencehonles commented 3 years ago

This may actually belong in https://github.com/googlecolab/colabtools if it is not fixed in this package and the frontend is adjusted.