]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/activitypub/video-comments.ts
More robust federation
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / activitypub / video-comments.ts
index 0415db21c27e7d5454ddfac568d59e87d7cc4736..e04c5388f9059bf5cfc7022fbbe0fe8cb302c786 100644 (file)
@@ -1,7 +1,7 @@
 import * as validator from 'validator'
-import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers'
+import { ACTIVITY_PUB } from '../../../initializers/constants'
 import { exists, isArray, isDateValid } from '../misc'
-import { isActivityPubUrlValid, isBaseActivityValid } from './misc'
+import { isActivityPubUrlValid } from './misc'
 
 function sanitizeAndCheckVideoCommentObject (comment: any) {
   if (!comment || comment.type !== 'Note') return false
@@ -36,7 +36,8 @@ function normalizeComment (comment: any) {
   if (!comment) return
 
   if (typeof comment.url !== 'string') {
-    comment.url = comment.url.href || comment.url.url
+    if (typeof comment.url === 'object') comment.url = comment.url.href || comment.url.url
+    else comment.url = comment.id
   }
 
   return