Skip to content

Commit 20b46c9

Browse files
committed
Fix time gate paths with trailing slash.
1 parent 08df075 commit 20b46c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/controllers/TimegateController.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ function TimegateController(options) {
3636
this._routers = options.routers || [];
3737

3838
// Set up path matching
39-
this._timegatePath = timegates.baseUrl || '/timegate/',
40-
this._matcher = new RegExp('^' + Util.toRegExp(this._timegatePath) + '((.+?)\\?|(.+))');
39+
this._timegatePath = timegates.baseUrl || '/timegate/',
40+
this._matcher = new RegExp('^' + Util.toRegExp(this._timegatePath) + '(.+?)\/?$');
4141
}
4242
Controller.extend(TimegateController);
4343

4444
// Tries to serve the requested Timegate
4545
TimegateController.prototype._handleRequest = function (request, response, next) {
4646
var self = this, timegateMatch = this._matcher && this._matcher.exec(request.url),
47-
datasource = timegateMatch && (timegateMatch[2] || timegateMatch[1]);
47+
datasource = timegateMatch && timegateMatch[1];
4848
if (datasource && this._timemaps[datasource]) {
4949
// retrieve Accept-Datetime & construct memento link
5050
var acceptDatetime = toDate(request.headers['accept-datetime']), // If no datetime is present, return most recent one

0 commit comments

Comments
 (0)