mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
scheme-relative url rewrite compatbility:
Make scheme-relative extraction change (#404) apply only to urls captured after 2018-11-11 (when changed was made) to avoid breaking older captures, which were likely captured scheme relative urls would be replayed with 'http:'
This commit is contained in:
parent
3e0bb49ae1
commit
0f6ad30056
@ -75,6 +75,9 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
||||
var wb_orig_origin;
|
||||
var wb_curr_host;
|
||||
|
||||
// scheme to use when resolving scheme-relative urls
|
||||
var wb_rel_scheme_default;
|
||||
|
||||
var wb_setAttribute = $wbwindow.Element.prototype.setAttribute;
|
||||
var wb_getAttribute = $wbwindow.Element.prototype.getAttribute;
|
||||
var wb_funToString = Function.prototype.toString;
|
||||
@ -505,7 +508,7 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
||||
}
|
||||
|
||||
if (href != orig_href && !starts_with(href, VALID_PREFIXES)) {
|
||||
href = wb_orig_scheme + href;
|
||||
href = wb_rel_scheme_default + "://" + href;
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,7 +517,7 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
||||
}
|
||||
|
||||
if (starts_with(href, REL_PREFIX)) {
|
||||
href = wb_info.wombat_scheme + ":" + href;
|
||||
href = wb_rel_scheme_default + ":" + href;
|
||||
}
|
||||
|
||||
return href;
|
||||
@ -3491,6 +3494,15 @@ var _WBWombat = function($wbwindow, wbinfo) {
|
||||
wb_orig_scheme = wbinfo.wombat_scheme + '://';
|
||||
wb_orig_origin = wb_orig_scheme + wbinfo.wombat_host;
|
||||
|
||||
var SCHEME_REL_CHANGE_TIMESTAMP = "20181101";
|
||||
|
||||
// if replaying ccontent from before this date, use http for replay
|
||||
if (!wbinfo.is_live && wbinfo.timestamp < SCHEME_REL_CHANGE_TIMESTAMP) {
|
||||
wb_rel_scheme_default = "http";
|
||||
} else {
|
||||
wb_rel_scheme_default = wbinfo.wombat_scheme;
|
||||
}
|
||||
|
||||
wb_abs_prefix = wb_replay_prefix;
|
||||
|
||||
if (!wbinfo.is_live && wbinfo.wombat_ts) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user