diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/videos.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 907fe458d..2a6636625 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -177,7 +177,9 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor: | |||
177 | 177 | ||
178 | async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentObject | string, actor?: ActorModel) { | 178 | async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentObject | string, actor?: ActorModel) { |
179 | if (typeof videoObject === 'string') { | 179 | if (typeof videoObject === 'string') { |
180 | const videoFromDatabase = await VideoModel.loadByUrlAndPopulateAccount(videoObject) | 180 | const videoUrl = videoObject |
181 | |||
182 | const videoFromDatabase = await VideoModel.loadByUrlAndPopulateAccount(videoUrl) | ||
181 | if (videoFromDatabase) { | 183 | if (videoFromDatabase) { |
182 | return { | 184 | return { |
183 | video: videoFromDatabase, | 185 | video: videoFromDatabase, |
@@ -186,8 +188,8 @@ async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentOb | |||
186 | } | 188 | } |
187 | } | 189 | } |
188 | 190 | ||
189 | videoObject = await fetchRemoteVideo(videoObject) | 191 | videoObject = await fetchRemoteVideo(videoUrl) |
190 | if (!videoObject) throw new Error('Cannot fetch remote video (maybe invalid...)') | 192 | if (!videoObject) throw new Error('Cannot fetch remote video with url: ' + videoUrl) |
191 | } | 193 | } |
192 | 194 | ||
193 | if (!actor) { | 195 | if (!actor) { |
@@ -268,9 +270,12 @@ async function addVideoShares (instance: VideoModel, shareUrls: string[]) { | |||
268 | json: true, | 270 | json: true, |
269 | activityPub: true | 271 | activityPub: true |
270 | }) | 272 | }) |
271 | const actorUrl = body.actor | 273 | if (!body || !body.actor) { |
272 | if (!actorUrl) continue | 274 | logger.warn('Cannot add remote share with url: %s, skipping...', shareUrl) |
275 | continue | ||
276 | } | ||
273 | 277 | ||
278 | const actorUrl = body.actor | ||
274 | const actor = await getOrCreateActorAndServerAndModel(actorUrl) | 279 | const actor = await getOrCreateActorAndServerAndModel(actorUrl) |
275 | 280 | ||
276 | const entry = { | 281 | const entry = { |