1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

rewrite: add rewriting of <meta> content="" attribute if it is a url

This commit is contained in:
Ilya Kreymer 2016-02-25 18:49:31 -08:00
parent 8fc789cc8f
commit fc5d7cc7cd
2 changed files with 8 additions and 0 deletions

View File

@ -294,6 +294,8 @@ class HTMLRewriterMixin(object):
elif (tag == 'meta') and (attr_name == 'content'):
if self.has_attr(tag_attrs, ('http-equiv', 'refresh')):
attr_value = self._rewrite_meta_refresh(attr_value)
elif attr_value.startswith(self.DATA_RW_PROTOCOLS):
attr_value = self._rewrite_url(attr_value, rw_mod)
# special case: param value, conditional rewrite
elif (tag == 'param'):

View File

@ -93,6 +93,12 @@ ur"""
>>> parse('<META http-equiv="refresh" content>')
<meta http-equiv="refresh" content="">
>>> parse('<meta property="og:image" content="http://example.com/example.jpg">')
<meta property="og:image" content="/web/20131226101010/http://example.com/example.jpg">
>>> parse('<meta property="og:image" content="example.jpg">')
<meta property="og:image" content="example.jpg">
# Custom -data attribs
>>> parse('<div data-url="http://example.com/a/b/c.html" data-some-other-value="http://example.com/img.gif">')
<div data-url="/web/20131226101010oe_/http://example.com/a/b/c.html" data-some-other-value="/web/20131226101010oe_/http://example.com/img.gif">