diff --git a/folium/utilities.py b/folium/utilities.py index bd7f190ce4..f44828f8fd 100644 --- a/folium/utilities.py +++ b/folium/utilities.py @@ -21,6 +21,7 @@ _VALID_URLS = set(uses_relative + uses_netloc + uses_params) _VALID_URLS.discard('') +_VALID_URLS.add('data') def validate_location(location): # noqa: C901 diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 5a31a0ad8a..9e012d4fbb 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -11,6 +11,7 @@ deep_copy, get_obj_in_upper_tree, parse_options, + _is_url, ) @@ -154,3 +155,14 @@ def test_parse_options(): assert parse_options(thing=None) == {} assert parse_options(long_thing=42) == {'longThing': 42} assert parse_options(thing=42, lst=[1, 2]) == {'thing': 42, 'lst': [1, 2]} + + +@pytest.mark.parametrize('url', [ + "https://example.com/img.png", + "http://example.com/img.png", + "ftp://example.com/img.png", + "file:///t.jpg", + "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", +]) +def test_is_url(url): + assert _is_url(url) is True