Skip to content

Commit

Permalink
Fixed the HEAD method crashing when the size of a resource is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jul 10, 2017
1 parent 8e8b425 commit de276ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/server/v2/commands/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ var default_1 = (function () {
ctx.setCode(WebDAVRequest_1.HTTPCodes.OK);
ctx.response.setHeader('Accept-Ranges', 'bytes');
ctx.response.setHeader('Content-Type', mimeType);
ctx.response.setHeader('Content-Length', size.toString());
if (size !== null && size !== undefined && size > -1)
ctx.response.setHeader('Content-Length', size.toString());
}
callback();
});
Expand Down
3 changes: 2 additions & 1 deletion src/server/v2/commands/Head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default class implements HTTPMethod
ctx.setCode(HTTPCodes.OK);
ctx.response.setHeader('Accept-Ranges', 'bytes')
ctx.response.setHeader('Content-Type', mimeType);
ctx.response.setHeader('Content-Length', size.toString());
if(size !== null && size !== undefined && size > -1)
ctx.response.setHeader('Content-Length', size.toString());
}
callback();
})
Expand Down

0 comments on commit de276ff

Please sign in to comment.