From 04c44e63faab261bc6453eec0b8b3e6387fe145a Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 25 Oct 2011 11:57:42 +0200 Subject: [PATCH] Make sure OPTIONS for the root does not default. --- photo-server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/photo-server.js b/photo-server.js index da318f6..c534a6e 100644 --- a/photo-server.js +++ b/photo-server.js @@ -50,7 +50,7 @@ app.get(/^\/photos\/(\d+)$/, getPhoto); app.get(/^\/photos\/(\d+)\/faces$/, getFaces); app.get(/^\/photos\/(\d+)\/faces\/(\d+)$/, getFace); app.get(/^\/photos\/(\d+)\/persons\/(\d+)$/, getPerson); -app.options(/^\/([\d\w\/]+)$/, getDescription); +app.options(/^\/([\d\w\/]*)$/, getDescription); /*** handlers ***/ @@ -102,6 +102,9 @@ function getPerson(req, res, next) { } function getDescription(req, res, next) { + if(!req.params[0].length) + return respond.withText(res, '', 'text/n3'); + var uriPattern = new RegExp(req.params[0].replace(/\//g, '-') .replace(/\d+/g, 'id') + '.*'); fs.readdir('descriptions', function (err, fileNames) {