1
0
mirror of https://framagit.org/framasoft/peertube/search-index/ synced 2024-12-24 00:21:05 +01:00

Throw on invalid data

This commit is contained in:
Chocobozzz 2020-06-08 15:50:20 +02:00
parent a9d49c41ee
commit 8d2fd71f61
No known key found for this signature in database
GPG Key ID: 583A612D890159BE

View File

@ -41,6 +41,10 @@ async function getVideos (host: string, start: number): Promise<IndexableVideo[]
json: true
}, REQUESTS.MAX_RETRIES, REQUESTS.WAIT)
if (!res.body || !Array.isArray(res.body.data)) {
throw new Error('Invalid video data from ' + url)
}
return res.body.data.map(v => prepareVideoForDB(v, host))
}