aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-13 14:55:18 +0200
committerChocobozzz <me@florianbigard.com>2018-06-13 14:55:18 +0200
commitbcec136ee62ee9fcc0f0177e9dd0ac191a2cf5ee (patch)
tree2721b7308d670d1172a23f9dfbbbeac4ed689ddb /server
parent90d4bb8125e80c8060416d4d135ddeaf0a622ede (diff)
downloadPeerTube-bcec136ee62ee9fcc0f0177e9dd0ac191a2cf5ee.tar.gz
PeerTube-bcec136ee62ee9fcc0f0177e9dd0ac191a2cf5ee.tar.zst
PeerTube-bcec136ee62ee9fcc0f0177e9dd0ac191a2cf5ee.zip
Fix lint
Diffstat (limited to 'server')
-rw-r--r--server/helpers/custom-validators/activitypub/activity.ts2
-rw-r--r--server/lib/activitypub/process/process-delete.ts4
2 files changed, 4 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts
index 1d2ef2ac6..381a29e66 100644
--- a/server/helpers/custom-validators/activitypub/activity.ts
+++ b/server/helpers/custom-validators/activitypub/activity.ts
@@ -16,6 +16,7 @@ import {
16 sanitizeAndCheckVideoTorrentUpdateActivity 16 sanitizeAndCheckVideoTorrentUpdateActivity
17} from './videos' 17} from './videos'
18import { isViewActivityValid } from './view' 18import { isViewActivityValid } from './view'
19import { exists } from '../misc'
19 20
20function isRootActivityValid (activity: any) { 21function isRootActivityValid (activity: any) {
21 return Array.isArray(activity['@context']) && ( 22 return Array.isArray(activity['@context']) && (
@@ -26,6 +27,7 @@ function isRootActivityValid (activity: any) {
26 ) || 27 ) ||
27 ( 28 (
28 isActivityPubUrlValid(activity.id) && 29 isActivityPubUrlValid(activity.id) &&
30 exists(activity.actor) &&
29 (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id)) 31 (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
30 ) 32 )
31 ) 33 )
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts
index ff0caa343..3c830abea 100644
--- a/server/lib/activitypub/process/process-delete.ts
+++ b/server/lib/activitypub/process/process-delete.ts
@@ -15,7 +15,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
15 15
16 if (activity.actor === objectUrl) { 16 if (activity.actor === objectUrl) {
17 let actor = await ActorModel.loadByUrl(activity.actor) 17 let actor = await ActorModel.loadByUrl(activity.actor)
18 if (!actor) return 18 if (!actor) return undefined
19 19
20 if (actor.type === 'Person') { 20 if (actor.type === 'Person') {
21 if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.') 21 if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.')
@@ -45,7 +45,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
45 } 45 }
46 } 46 }
47 47
48 return 48 return undefined
49} 49}
50 50
51// --------------------------------------------------------------------------- 51// ---------------------------------------------------------------------------