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

Merge branch 'develop' into py3

This commit is contained in:
Ilya Kreymer 2016-03-03 14:09:00 -08:00
commit bb806d7f26
7 changed files with 19 additions and 6 deletions

View File

@ -1,4 +1,4 @@
PyWb 0.11.1
PyWb 0.11.2
===========
.. image:: https://travis-ci.org/ikreymer/pywb.svg?branch=master

View File

@ -297,6 +297,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

@ -244,8 +244,9 @@ class RewriteContent:
if m:
charset = m.group(1)
charset = to_native_str(charset)
content_type = 'text/html; charset=' + charset
status_headers.replace_header('content-type', content_type)
# content_type = 'text/html; charset=' + charset
# status_headers.replace_header('content-type', content_type)
return charset
@staticmethod

View File

@ -94,6 +94,12 @@ r"""
>>> 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">

View File

@ -209,7 +209,7 @@ def test_example_1():
# verify utf-8 charset detection
assert status_headers.get_header('content-type') == 'text/html; charset=utf-8'
assert status_headers.get_header('content-type') == 'text/html'
assert '/pywb/20131226101010/http://www.iana.org/domains/example' in buff, buff

View File

@ -63,8 +63,12 @@ this.create_banner_element = function() {
this.ts_to_date = function(ts, is_gmt)
{
if (!ts) {
return "";
}
if (ts.length < 14) {
return ts;
ts += "00000000000000".substr(ts.length);
}
var datestr = (ts.substring(0, 4) + "-" +

View File

@ -108,7 +108,7 @@ class SearchPageWbUrlHandler(WbUrlHandler):
def get_top_frame_response(self, wbrequest):
params = self.get_top_frame_params(wbrequest, mod=self.replay_mod)
headers = [('Content-Type', 'text/html; charset=utf-8')]
headers = [('Content-Type', 'text/html')]
status_headers = StatusAndHeaders('200 OK', headers)
template_result = self.frame_insert_view.render_to_string(**params)