jupyter / jupyter/notebook

Links to (local) relative file paths in HTML output displays are not resolved correctly

Open
#3,357 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

Hello,

Say I want to display a local HTML file (e.g. "/tmp/data/overview.html") which itself includes tags pointing to image files in same or child folder.

```
From IPython.core.display import HTML
HTML(filename=local_html_file)
```

This file for example contains this
``

Observed behaviour:
This does not resolve correctly, as it resolves it relative to the working directory of the current notebook server.

[W 16:36:03.125 NotebookApp] 404 GET /notebooks/testing/demultiplex-summary.png (127.0.0.1): No such file or directory: testing/demultiplex-summary.png

Expected behaviour:
It should resolve to the file relative to the html file loaded, with the image (or other iframe or video or css etc) loading/displaying correctly.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with IPython.core.display.HTML(filename=local_html_file) and an HTML file containing a relative image path. Trace how the HTML output resolves resource URLs; done means images, iframes, video, and CSS referenced relative to the loaded HTML file display correctly rather than relative to the notebook server's working directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.