]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix validators issue
authorChocobozzz <me@florianbigard.com>
Tue, 19 Dec 2017 17:09:44 +0000 (18:09 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 20 Dec 2017 08:05:16 +0000 (09:05 +0100)
server/helpers/custom-validators/activitypub/announce.ts
server/helpers/custom-validators/activitypub/misc.ts

index 469ed5127ecc53276576daa5b40fde9b7ab568ca..1baea4f6047c697e3eb6684f767baec852b28c74 100644 (file)
@@ -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)
     )
 }
 
index 3ca4e4ff4be93222d78445660168a351f3468c1a..aa6ffc9bddfeaefd73fb9ec0202f9359f13a0835 100644 (file)
@@ -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) {