jupyter / nbdime

Tools for diffing and merging of Jupyter notebooks.
http://nbdime.readthedocs.io
Other
2.66k stars 159 forks source link

nbmergetool ignores base_url when calling /api/closetool endpoint. #569

Open vtikhonov opened 3 years ago

vtikhonov commented 3 years ago

In my scenario base_url is used when running nbmergetool under git mergetool, and jupyterlab server proxy is used as a proxy.

nbmerge_config.json:

{
    "NbMergeTool": {
        "base_url": "/proxy/absolute/8182/",
        "port": 8182,
        "browser": "-" ###  just to skip loading browser tab, as it is opened manually  (so far, for another reason)
    }
}

nbdime web page loads fine, it allows to resolve conflicts and save the result, but pushing Close Tool button attempts to access /api/closetool endpoint instead of /proxy/absolute/8182/api/closetool. So user needs to manually close the resolving tab in browser and stop git mergetool --tool nbdime process.

nbdime_merge_close_tool_issue

As far as I can understand the reason is that base_url is honoured when saving notebook https://github.com/jupyter/nbdime/blob/3.0.0b1/packages/webapp/src/app/merge.ts#L267-L269, but is ignored when sending closetool notification https://github.com/jupyter/nbdime/blob/3.0.0b1/packages/webapp/src/app/common.ts#L224-L225

So I guess the fix may be rather easy there, just prepend that base_url in closeTool function.

vtikhonov commented 3 years ago

Just for clarity: I used v3.0.0b1 in my env, as jupyterlab version is also 3.x, and it seems that master branch of nbdime has that issue too.