Merge branch 'Chocobozzz:develop' into feature/Remember-user-table-pagination-in-admin

This commit is contained in:
Wicklow 2023-10-11 15:45:41 +00:00 committed by GitHub
commit 72a7463533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 19 deletions

View File

@ -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)
})

View File

@ -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: '' } })
}
}

View File

@ -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

View File

@ -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<Instance>)
if (parsedTorrent.files.length !== 1) {
cleanUpReqFiles(req)

View File

@ -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')
}