diff --git a/packages/tests/src/api/videos/resumable-upload.ts b/packages/tests/src/api/videos/resumable-upload.ts index 628e0298c..1f97ab4d1 100644 --- a/packages/tests/src/api/videos/resumable-upload.ts +++ b/packages/tests/src/api/videos/resumable-upload.ts @@ -183,14 +183,9 @@ describe('Test resumable upload', function () { it('Should not accept more chunks than expected with an invalid content length/content range', async function () { const uploadId = await prepareUpload({ size: 1500 }) - // Content length check can be different depending on the node version - try { - await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentLength: 1000 }) - await checkFileSize(uploadId, 0) - } catch { - await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.BAD_REQUEST_400, contentLength: 1000 }) - await checkFileSize(uploadId, 0) - } + await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentLength: 1000 }) + + await checkFileSize(uploadId, 0) }) it('Should not accept more chunks than expected with an invalid content length', async function () { @@ -198,13 +193,8 @@ describe('Test resumable upload', function () { const size = 1000 - // Content length check seems to have changed in v16 - const expectedStatus = process.version.startsWith('v16') - ? HttpStatusCode.CONFLICT_409 - : HttpStatusCode.BAD_REQUEST_400 - const contentRangeBuilder = (start: number) => `bytes ${start}-${start + size - 1}/${size}` - await sendChunks({ pathUploadId: uploadId, expectedStatus, contentRangeBuilder, contentLength: size }) + await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentRangeBuilder, contentLength: size }) await checkFileSize(uploadId, 0) }) diff --git a/packages/tests/src/shared/peertube-runner-process.ts b/packages/tests/src/shared/peertube-runner-process.ts index 784d81235..414d1f5bf 100644 --- a/packages/tests/src/shared/peertube-runner-process.ts +++ b/packages/tests/src/shared/peertube-runner-process.ts @@ -1,5 +1,5 @@ import { ChildProcess, fork, ForkOptions } from 'child_process' -import { execa } from 'execa' +import { execaNode } from 'execa' import { join } from 'path' import { root } from '@peertube/peertube-node-utils' import { PeerTubeServer } from '@peertube/peertube-server-commands' @@ -99,6 +99,6 @@ export class PeerTubeRunnerProcess { } private runCommand (path: string, args: string[]) { - return execa.node(path, args, { env: { ...process.env, NODE_OPTIONS: '' } }) + return execaNode(path, args, { env: { ...process.env, NODE_OPTIONS: '' } }) } } diff --git a/scripts/ci.sh b/scripts/ci.sh index 0046fe41a..d06f1c675 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -51,7 +51,7 @@ if [ "$1" = "types-package" ]; then cp -r packages/types-generator/dist /tmp/types-generator/dist (cd /tmp/types-generator/dist && npm install) - npm run tsc -- --noEmit --esModuleInterop --moduleResolution node16 /tmp/types-generator/tests/test.ts + npm run tsc -- --noEmit --esModuleInterop --moduleResolution node16 --module Node16 /tmp/types-generator/tests/test.ts rm -r /tmp/types-generator elif [ "$1" = "client" ]; then npm run build diff --git a/server/core/controllers/api/videos/import.ts b/server/core/controllers/api/videos/import.ts index 185215cc9..5e6694899 100644 --- a/server/core/controllers/api/videos/import.ts +++ b/server/core/controllers/api/videos/import.ts @@ -237,7 +237,8 @@ async function processTorrentOrAbortRequest (req: express.Request, res: express. torrentfile.path = newTorrentPath const buf = await readFile(torrentfile.path) - const parsedTorrent = parseTorrent(buf) as Instance + // FIXME: typings: parseTorrent now returns an async result + const parsedTorrent = await (parseTorrent(buf) as unknown as Promise) if (parsedTorrent.files.length !== 1) { cleanUpReqFiles(req) diff --git a/server/core/lib/signup.ts b/server/core/lib/signup.ts index a5e9e93c9..f4e0aef65 100644 --- a/server/core/lib/signup.ts +++ b/server/core/lib/signup.ts @@ -38,7 +38,7 @@ export function isSignupAllowedForCurrentIP (ip: string) { let matched = '' // if there is a valid, non-empty whitelist, we exclude all unknown addresses too - if (CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isIPV4Cidr(cidr) || isIPV6Cidr(cidr))) { + if (CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.some(cidr => isIPV4Cidr(cidr) || isIPV6Cidr(cidr))) { excludeList.push('unknown') }