1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

wombat: fix rewrite_attr not actually being rewritten due to incomplete refactor

when is_live, don't add timestamp to rewritten urls (hypothesis/via#11)
This commit is contained in:
Ilya Kreymer 2015-05-09 18:00:53 -07:00
parent 0f5d32e80e
commit a6eb604273

View File

@ -747,7 +747,6 @@ _WBWombat = (function() {
value = func(value); value = func(value);
} }
// this now handles the actual rewrite
elem._orig_setAttribute(name, value); elem._orig_setAttribute(name, value);
} }
@ -766,8 +765,8 @@ _WBWombat = (function() {
//============================================ //============================================
function rewrite_elem(elem) function rewrite_elem(elem)
{ {
rewrite_attr(elem, "src"); rewrite_attr(elem, "src", rewrite_url);
rewrite_attr(elem, "href"); rewrite_attr(elem, "href", rewrite_url);
rewrite_attr(elem, "style", rewrite_style); rewrite_attr(elem, "style", rewrite_style);
if (elem && elem.getAttribute && elem.getAttribute("crossorigin")) { if (elem && elem.getAttribute && elem.getAttribute("crossorigin")) {
@ -827,6 +826,7 @@ _WBWombat = (function() {
var created = orig.apply(this, arguments); var created = orig.apply(this, arguments);
if (!created) { if (!created) {
return; return;
} }
@ -1005,9 +1005,23 @@ _WBWombat = (function() {
wb_opts = wbinfo.wombat_opts || {}; wb_opts = wbinfo.wombat_opts || {};
if (wb_replay_prefix) { if (wb_replay_prefix) {
wb_replay_date_prefix = wb_replay_prefix + wbinfo.wombat_ts + wbinfo.mod + "/";
if (wbinfo.wombat_ts.length > 0) { var ts_mod;
// if live, don't add the timestamp
if (wbinfo.is_live) {
ts_mod = wbinfo.mod;
} else {
ts_mod = wbinfo.wombat_ts + wbinfo.mod;
}
if (ts_mod != "") {
ts_mod += "/";
}
wb_replay_date_prefix = wb_replay_prefix + ts_mod;
if (!wbinfo.is_live && wbinfo.wombat_ts.length > 0) {
wb_capture_date_part = "/" + wbinfo.wombat_ts + "/"; wb_capture_date_part = "/" + wbinfo.wombat_ts + "/";
} else { } else {
wb_capture_date_part = ""; wb_capture_date_part = "";