Closed
Description
Describe the bug
Supplying a data URI as image parameter to ImageOverlay raise FileNotFound error.
To Reproduce
from folium.raster_layers import ImageOverlay
img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
ImageOverlay(img_url, bounds=[[0,0], [1,1]])
Expected behavior
Image url is passed into output as is.
Environment (please complete the following information):
- Browser firefox
- Jupyter Notebook or html files -- jupyter lab?
- Python version 3.8
- folium version 0.11.0
- branca version 0.3.1
Possible solutions
Problem is due to data
scheme being absent from the allow list here:
Lines 22 to 23 in ae12f97
Patching it at run time solves the problem, i.e. this works as expected
import folium.utilities
folium.utilities._VALID_URLS.add('data')
from folium.raster_layers import ImageOverlay
img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
ImageOverlay(img_url, bounds=[[0,0], [1,1]])
Metadata
Metadata
Assignees
Labels
No labels