From 39824711f06cd6c650b17fb17b28c2db2faa5720 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 23 Feb 2015 23:21:39 -0800 Subject: [PATCH] memento tweak: ensure rel=memento link for timegate uses exact in Location (cdx original) as opposed to url from request --- pywb/framework/memento.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pywb/framework/memento.py b/pywb/framework/memento.py index 29fe7ca8..d5604bc6 100644 --- a/pywb/framework/memento.py +++ b/pywb/framework/memento.py @@ -74,10 +74,13 @@ class MementoRespMixin(object): is_memento = (wbrequest.wb_url.type == wbrequest.wb_url.REPLAY) link = [] + req_url = wbrequest.wb_url.url if is_memento or is_timegate: + url = req_url if cdx: ts = cdx['timestamp'] + url = cdx['original'] # for top frame elif wbrequest.wb_url.timestamp: ts = wbrequest.wb_url.timestamp @@ -91,13 +94,14 @@ class MementoRespMixin(object): self.status_headers.headers.append(('Memento-Datetime', http_date)) - canon_link = wbrequest.urlrewriter.get_new_url(mod='', timestamp=ts) + canon_link = wbrequest.urlrewriter.get_new_url(mod='', + timestamp=ts, + url=url) + link.append(self.make_memento_link(canon_link, 'memento', http_date)) - req_url = wbrequest.wb_url.url - if is_memento and is_timegate: link.append(self.make_link(req_url, 'original timegate')) else: