1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Update torrents info name on video update

This commit is contained in:
Chocobozzz 2021-12-08 11:32:45 +01:00
parent 9b293cd6a2
commit 38d69d6501
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 18 additions and 8 deletions

View file

@ -1,5 +1,6 @@
import express from 'express'
import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details'
import { logger } from '@server/helpers/logger'
import { HttpStatusCode } from '@shared/models'
function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) {
@ -18,7 +19,8 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
res.status(status)
res.setHeader('Content-Type', 'application/problem+json')
res.json(new ProblemDocument({
const json = new ProblemDocument({
status,
title,
instance,
@ -28,7 +30,11 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
type: type
? `https://docs.joinpeertube.org/api-rest-reference.html#section/Errors/${type}`
: undefined
}, extension))
}, extension)
logger.debug('Bad HTTP request.', { json })
res.json(json)
}
if (next) next()