mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-14 03:16:24 +00:00
server parseHttpRequest(): simplify info_hash checking
This commit is contained in:
parent
217bcf7de5
commit
c97e4236f4
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user