mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Fix infinite server crash on invalid zip import
This commit is contained in:
parent
0fc3f91d83
commit
71744313f0
3 changed files with 6 additions and 4 deletions
BIN
packages/tests/fixtures/export-crash.zip
vendored
Normal file
BIN
packages/tests/fixtures/export-crash.zip
vendored
Normal file
Binary file not shown.
|
@ -3,7 +3,8 @@
|
|||
import { HttpStatusCode } from '@peertube/peertube-models'
|
||||
import {
|
||||
cleanupTests,
|
||||
createSingleServer, PeerTubeServer,
|
||||
createSingleServer,
|
||||
PeerTubeServer,
|
||||
setAccessTokensToServers,
|
||||
waitJobs
|
||||
} from '@peertube/peertube-server-commands'
|
||||
|
@ -37,7 +38,6 @@ describe('Test user import API validators', function () {
|
|||
})
|
||||
|
||||
describe('Request import', function () {
|
||||
|
||||
it('Should fail if import is disabled', async function () {
|
||||
await server.config.disableUserImport()
|
||||
|
||||
|
@ -121,7 +121,8 @@ describe('Test user import API validators', function () {
|
|||
'export-bad-video.zip',
|
||||
'export-without-videos.zip',
|
||||
'export-bad-structure.zip',
|
||||
'export-bad-structure.zip'
|
||||
'export-bad-structure.zip',
|
||||
'export-crash.zip'
|
||||
]
|
||||
|
||||
const tokens: string[] = []
|
||||
|
@ -141,7 +142,6 @@ describe('Test user import API validators', function () {
|
|||
})
|
||||
|
||||
describe('Get latest import status', function () {
|
||||
|
||||
it('Should fail without token', async function () {
|
||||
await server.userImports.getLatestImport({ userId, token: null, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
|
|
@ -16,6 +16,8 @@ export async function unzip (source: string, destination: string) {
|
|||
yauzl.open(source, { lazyEntries: true }, (err, zipFile) => {
|
||||
if (err) return rej(err)
|
||||
|
||||
zipFile.on('error', err => rej(err))
|
||||
|
||||
zipFile.readEntry()
|
||||
|
||||
zipFile.on('entry', async entry => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue