diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-21 10:16:20 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-21 10:16:20 +0100 |
commit | 604abfbef5e80d94e46658e4efa762adeab855ea (patch) | |
tree | 7b1522812841064376713ea717614a95d3fd95a7 /server/helpers | |
parent | 225a89c2afbbe53cf39ffa7ea0cd485095a1d5f5 (diff) | |
download | PeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.tar.gz PeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.tar.zst PeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.zip |
Fix webfinger validator
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/core-utils.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/webfinger.ts | 3 |
2 files changed, 2 insertions, 3 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) { | |||
27 | 27 | ||
28 | // Don't import remote scheme from constants because we are in core utils | 28 | // Don't import remote scheme from constants because we are in core utils |
29 | function sanitizeHost (host: string, remoteScheme: string) { | 29 | function sanitizeHost (host: string, remoteScheme: string) { |
30 | let toRemove = remoteScheme === 'https' ? 443 : 80 | 30 | const toRemove = remoteScheme === 'https' ? 443 : 80 |
31 | 31 | ||
32 | return host.replace(new RegExp(`:${toRemove}$`), '') | 32 | return host.replace(new RegExp(`:${toRemove}$`), '') |
33 | } | 33 | } |
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) { | |||
11 | if (actorParts.length !== 2) return false | 11 | if (actorParts.length !== 2) return false |
12 | 12 | ||
13 | const host = actorParts[1] | 13 | const host = actorParts[1] |
14 | 14 | return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOST | |
15 | return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOSTNAME | ||
16 | } | 15 | } |
17 | 16 | ||
18 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |