File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -313,12 +313,19 @@ def replace(match: Match):
313
313
file = self ._queue (url , config )
314
314
el .set ("src" , resolve (file ))
315
315
316
+ # Handle external image in SVG
317
+ if el .tag == "image" :
318
+ url = urlparse (el .get ("href" ))
319
+ if not self ._is_excluded (url , initiator ):
320
+ file = self ._queue (url , config )
321
+ el .set ("href" , resolve (file ))
322
+
316
323
# Return element as string
317
324
return self ._print (el )
318
325
319
326
# Find and replace all external asset URLs in current page
320
327
return re .sub (
321
- r"<(?:(?:a|link)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>" ,
328
+ r"<(?:(?:a|link|image )[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>" ,
322
329
replace , output , flags = re .I | re .M
323
330
)
324
331
Original file line number Diff line number Diff line change @@ -313,12 +313,19 @@ def replace(match: Match):
313
313
file = self ._queue (url , config )
314
314
el .set ("src" , resolve (file ))
315
315
316
+ # Handle external image in SVG
317
+ if el .tag == "image" :
318
+ url = urlparse (el .get ("href" ))
319
+ if not self ._is_excluded (url , initiator ):
320
+ file = self ._queue (url , config )
321
+ el .set ("href" , resolve (file ))
322
+
316
323
# Return element as string
317
324
return self ._print (el )
318
325
319
326
# Find and replace all external asset URLs in current page
320
327
return re .sub (
321
- r"<(?:(?:a|link)[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>" ,
328
+ r"<(?:(?:a|link|image )[^>]+href|(?:script|img)[^>]+src)=['\"]?http[^>]+>" ,
322
329
replace , output , flags = re .I | re .M
323
330
)
324
331
You can’t perform that action at this time.
0 commit comments