From 57f11c187b8d57afdce0172be3efda5757865d44 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Dec 2017 18:09:44 +0100 Subject: [PATCH] Fix validators issue --- server/helpers/custom-validators/activitypub/announce.ts | 4 ++-- server/helpers/custom-validators/activitypub/misc.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/helpers/custom-validators/activitypub/announce.ts b/server/helpers/custom-validators/activitypub/announce.ts index 469ed5127..1baea4f60 100644 --- a/server/helpers/custom-validators/activitypub/announce.ts +++ b/server/helpers/custom-validators/activitypub/announce.ts @@ -5,8 +5,8 @@ function isAnnounceActivityValid (activity: any) { console.log(activity) return isBaseActivityValid(activity, 'Announce') && ( - isActivityPubUrlValid(activity.object) || - isVideoTorrentCreateActivityValid(activity.object) + isVideoTorrentCreateActivityValid(activity.object) || + isActivityPubUrlValid(activity.object) ) } diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts index 3ca4e4ff4..aa6ffc9bd 100644 --- a/server/helpers/custom-validators/activitypub/misc.ts +++ b/server/helpers/custom-validators/activitypub/misc.ts @@ -17,7 +17,7 @@ function isActivityPubUrlValid (url: string) { isURLOptions.require_tld = false } - return exists(url) && validator.isURL(url, isURLOptions) && validator.isLength(url, CONSTRAINTS_FIELDS.ACTOR.URL) + return exists(url) && validator.isURL('' + url, isURLOptions) && validator.isLength('' + url, CONSTRAINTS_FIELDS.ACTOR.URL) } function isBaseActivityValid (activity: any, type: string) { -- 2.41.0