util: disallow empty content server-side too

This commit is contained in:
Peter Cai 2020-02-20 13:22:16 +08:00
parent 3a3ea823a9
commit 4338ea55e9
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
1 changed files with 2 additions and 1 deletions

View File

@ -16,7 +16,8 @@ MAX_FILENAME_LENGTH = 255 # bytes
# Validate content-length header
validateLength = (req) ->
(Number.parseInt req.headers.get "content-length") <= MAX_UPLOAD_SIZE
len = Number.parseInt req.headers.get "content-length"
len <= MAX_UPLOAD_SIZE && len > 0
# Only accept paths like `/paste/:file_name`
# No further slahses are supported