Skip to content

Commit 8d6c1ee

Browse files
YomesIncconst-cloudinary
authored andcommitted
Detect data URLs with suffix in mime type
1 parent ca7bdde commit 8d6c1ee

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

cloudinary/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
RANGE_VALUE_RE = r'^(?P<value>(\d+\.)?\d+)(?P<modifier>[%pP])?$'
3838
RANGE_RE = r'^(\d+\.)?\d+[%pP]?\.\.(\d+\.)?\d+[%pP]?$'
3939
FLOAT_RE = r'^(\d+)\.(\d+)?$'
40-
REMOTE_URL_RE = r'ftp:|https?:|s3:|gs:|data:([\w-]+\/[\w-]+)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9\/+\n=]+)$'
40+
REMOTE_URL_RE = r'ftp:|https?:|s3:|gs:|data:([\w-]+\/[\w-]+(\+[\w-]+)?)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9\/+\n=]+)$'
4141
__LAYER_KEYWORD_PARAMS = [("font_weight", "normal"),
4242
("font_style", "normal"),
4343
("text_decoration", "none"),

test/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@ def test_is_remote_url(self):
11091109
"data:image/gif;charset=utf8;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
11101110
"data:image/gif;param1=value1;param2=value2;base64," +
11111111
"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
1112+
"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg",
11121113
CL_BLANK
11131114
]
11141115

0 commit comments

Comments
 (0)