server parseHttpRequest(): simplify info_hash checking

This commit is contained in:
Astro 2014-12-11 17:07:37 +01:00
parent 217bcf7de5
commit c97e4236f4

View File

@ -44,12 +44,10 @@ function parseHttpRequest (req, options) {
if (params.info_hash) {
if (!Array.isArray(params.info_hash)) throw new Error('invalid info_hash array')
params.info_hash = params.info_hash.map(function (infoHash) {
params.info_hash.forEach(function (infoHash) {
if (infoHash.length !== 20) {
throw new Error('invalid info_hash')
}
return infoHash
})
}