Skip to content

Commit

Permalink
Fixed the response status when the parent was missing
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 28, 2017
1 parent 6fe546a commit 056df31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/server/v2/commands/Mkcol.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ var default_1 = (function () {
ctx.getResource(r.path.getParent(), function (e, rParent) {
rParent.type(function (e, parentType) {
if (e) {
if (!ctx.setCodeFromError(e))
if (e === Errors_1.Errors.ResourceNotFound)
ctx.setCode(WebDAVRequest_1.HTTPCodes.Conflict);
else if (!ctx.setCodeFromError(e))
ctx.setCode(WebDAVRequest_1.HTTPCodes.InternalServerError);
return callback();
}
Expand Down
4 changes: 3 additions & 1 deletion src/server/v2/commands/Mkcol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export default class implements HTTPMethod
rParent.type((e, parentType) => {
if(e)
{
if(!ctx.setCodeFromError(e))
if(e === Errors.ResourceNotFound)
ctx.setCode(HTTPCodes.Conflict);
else if(!ctx.setCodeFromError(e))
ctx.setCode(HTTPCodes.InternalServerError)
return callback();
}
Expand Down

0 comments on commit 056df31

Please sign in to comment.