diff --git a/lib/server/commands/Head.js b/lib/server/commands/Head.js index 11c84be1..2538a23a 100644 --- a/lib/server/commands/Head.js +++ b/lib/server/commands/Head.js @@ -11,13 +11,15 @@ function default_1(arg, callback) { var targetSource = arg.findHeader('source', 'F').toUpperCase() === 'T'; arg.checkIfHeader(r, function () { arg.requirePrivilege(targetSource ? ['canRead', 'canSource'] : ['canRead'], r, function () { - r.read(targetSource, function (e, c) { return process.nextTick(function () { + r.type(function (e, type) { if (e) + arg.setCode(WebDAVRequest_1.HTTPCodes.InternalServerError); + else if (!type.isFile) arg.setCode(WebDAVRequest_1.HTTPCodes.MethodNotAllowed); else arg.setCode(WebDAVRequest_1.HTTPCodes.OK); callback(); - }); }); + }); }); }); }); diff --git a/src/server/commands/Head.ts b/src/server/commands/Head.ts index 6ce20170..2af07405 100644 --- a/src/server/commands/Head.ts +++ b/src/server/commands/Head.ts @@ -15,13 +15,16 @@ export default function(arg : MethodCallArgs, callback) arg.checkIfHeader(r, () => { arg.requirePrivilege(targetSource ? [ 'canRead', 'canSource' ] : [ 'canRead' ], r, () => { - r.read(targetSource, (e, c) => process.nextTick(() => { + r.type((e, type) => { if(e) + arg.setCode(HTTPCodes.InternalServerError) + else if(!type.isFile) arg.setCode(HTTPCodes.MethodNotAllowed) else arg.setCode(HTTPCodes.OK); + callback(); - })) + }) }) }) })