Skip to content

Commit 98917fd

Browse files
author
Miel Vander Sande
committed
Proposed fix for original Base URL
1 parent e1e2172 commit 98917fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/controllers/MementoControllerExtension.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function MementoControllerExtension(settings) {
1212

1313
var timegates = settings.timegates || {}, timegateMap = {};
1414
this._timegateBaseUrl = timegates.baseURL || '/timegate/';
15+
this._baseUrl = settings.baseURL || '/';
1516
this._timegateMap = timegateMap;
1617
_.forIn(timegates.mementos || {}, function (setting, key) {
1718
setting.versions.forEach(function (entry) {
@@ -30,8 +31,8 @@ MementoControllerExtension.prototype._handleRequest = function (request, respons
3031
if (memento && memento.interval && memento.interval.length === 2) {
3132
var timegatePath = this._timegateBaseUrl + this._timegateMap[datasource].memento,
3233
timegateUrl = url.format(_.defaults({ pathname: timegatePath }, request.parsedUrl)),
33-
originalUrl = this._timegateMap[datasource].original ?
34-
this._timegateMap[datasource].original + requestQuery : timegateUrl,
34+
originalUrl = (this._timegateMap[datasource].original ?
35+
this._timegateMap[datasource].original : this._baseUrl + datasource) + requestQuery,
3536
datetime = new Date(memento.interval[0]).toUTCString();
3637

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

0 commit comments

Comments
 (0)