Skip to content

Commit 006aa0b

Browse files
author
Miel Vander Sande
committed
Fixed wrong original URL composition
1 parent 98917fd commit 006aa0b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/controllers/MementoControllerExtension.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ function MementoControllerExtension(settings) {
1212

1313
var timegates = settings.timegates || {}, timegateMap = {};
1414
this._timegateBaseUrl = timegates.baseURL || '/timegate/';
15-
this._baseUrl = settings.baseURL || '/';
1615
this._timegateMap = timegateMap;
1716
_.forIn(timegates.mementos || {}, function (setting, key) {
1817
setting.versions.forEach(function (entry) {
19-
timegateMap[entry] = { memento: key, original: setting.originalBaseURL };
18+
timegateMap[entry] = { memento: key,
19+
original: setting.originalBaseURL || ((settings.baseURL || '/') + key)
20+
};
2021
});
2122
});
23+
console.log(this._timegateMap);
2224
}
2325

2426
// Add Memento Link headers
@@ -31,8 +33,7 @@ MementoControllerExtension.prototype._handleRequest = function (request, respons
3133
if (memento && memento.interval && memento.interval.length === 2) {
3234
var timegatePath = this._timegateBaseUrl + this._timegateMap[datasource].memento,
3335
timegateUrl = url.format(_.defaults({ pathname: timegatePath }, request.parsedUrl)),
34-
originalUrl = (this._timegateMap[datasource].original ?
35-
this._timegateMap[datasource].original : this._baseUrl + datasource) + requestQuery,
36+
originalUrl = this._timegateMap[datasource].original + requestQuery,
3637
datetime = new Date(memento.interval[0]).toUTCString();
3738

3839
response.setHeader('Link', '<' + originalUrl + '>;rel=original, <' + timegateUrl + '>;rel=timegate');

0 commit comments

Comments
 (0)