From 604abfbef5e80d94e46658e4efa762adeab855ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 21 Dec 2017 10:16:20 +0100 Subject: [PATCH] Fix webfinger validator --- server/helpers/core-utils.ts | 2 +- server/helpers/custom-validators/webfinger.ts | 3 +-- server/initializers/migrations/0140-actor-url.ts | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index 0c6c36d11..4981bb4ec 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts @@ -27,7 +27,7 @@ function sanitizeUrl (url: string) { // Don't import remote scheme from constants because we are in core utils function sanitizeHost (host: string, remoteScheme: string) { - let toRemove = remoteScheme === 'https' ? 443 : 80 + const toRemove = remoteScheme === 'https' ? 443 : 80 return host.replace(new RegExp(`:${toRemove}$`), '') } diff --git a/server/helpers/custom-validators/webfinger.ts b/server/helpers/custom-validators/webfinger.ts index 46f1ac210..d8c1232ce 100644 --- a/server/helpers/custom-validators/webfinger.ts +++ b/server/helpers/custom-validators/webfinger.ts @@ -11,8 +11,7 @@ function isWebfingerResourceValid (value: string) { if (actorParts.length !== 2) return false const host = actorParts[1] - - return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOSTNAME + return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOST } // --------------------------------------------------------------------------- diff --git a/server/initializers/migrations/0140-actor-url.ts b/server/initializers/migrations/0140-actor-url.ts index 626f3c444..e64ee3487 100644 --- a/server/initializers/migrations/0140-actor-url.ts +++ b/server/initializers/migrations/0140-actor-url.ts @@ -1,6 +1,4 @@ import * as Sequelize from 'sequelize' -import { DataType } from 'sequelize-typescript' -import { createPrivateAndPublicKeys } from '../../helpers' import { CONFIG } from '../constants' async function up (utils: { -- 2.25.1