X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fwebfinger.ts;h=bcdd136c6ae3123a2f15577ed4492774440ebb70;hb=c756bae079e02873f6433582ca14a092fec0db27;hp=a71422ed8d9ce6b573af29425c2425ba4d909822;hpb=2d53be0267acc49cda46707b885096193a1f4e9c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/webfinger.ts b/server/middlewares/validators/webfinger.ts index a71422ed8..bcdd136c6 100644 --- a/server/middlewares/validators/webfinger.ts +++ b/server/middlewares/validators/webfinger.ts @@ -1,11 +1,11 @@ import * as express from 'express' import { query } from 'express-validator' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger' -import { logger } from '../../helpers/logger' -import { ActorModel } from '../../models/activitypub/actor' -import { areValidationErrors } from './utils' import { getHostWithPort } from '../../helpers/express-utils' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { logger } from '../../helpers/logger' +import { ActorModel } from '../../models/actor/actor' +import { areValidationErrors } from './shared' const webfingerValidator = [ query('resource').custom(isWebfingerLocalResourceValid).withMessage('Should have a valid webfinger resource'), @@ -21,9 +21,10 @@ const webfingerValidator = [ const actor = await ActorModel.loadLocalUrlByName(name) if (!actor) { - return res.status(HttpStatusCode.NOT_FOUND_404) - .send({ error: 'Actor not found' }) - .end() + return res.fail({ + status: HttpStatusCode.NOT_FOUND_404, + message: 'Actor not found' + }) } res.locals.actorUrl = actor