Skip to content

Commit 830bd98

Browse files
committed
Treat data uris as valid (#1427)
1 parent ae12f97 commit 830bd98

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

folium/utilities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
_VALID_URLS = set(uses_relative + uses_netloc + uses_params)
2323
_VALID_URLS.discard('')
24+
_VALID_URLS.add('data')
2425

2526

2627
def validate_location(location): # noqa: C901

tests/test_utilities.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
deep_copy,
1212
get_obj_in_upper_tree,
1313
parse_options,
14+
_is_url,
1415
)
1516

1617

@@ -154,3 +155,14 @@ def test_parse_options():
154155
assert parse_options(thing=None) == {}
155156
assert parse_options(long_thing=42) == {'longThing': 42}
156157
assert parse_options(thing=42, lst=[1, 2]) == {'thing': 42, 'lst': [1, 2]}
158+
159+
160+
@pytest.mark.parametrize('url', [
161+
"https://example.com/img.png",
162+
"http://example.com/img.png",
163+
"ftp://example.com/img.png",
164+
"file:///t.jpg",
165+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
166+
])
167+
def test_is_url(url):
168+
assert _is_url(url) is True

0 commit comments

Comments
 (0)