aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-23 09:10:49 +0100
committerChocobozzz <me@florianbigard.com>2018-03-23 09:10:49 +0100
commit8e8234abba7b64767e9ffb6dc38758a62b1ea16c (patch)
tree23b15dd6a8de33d0462b02d1545d724ab0998e59 /server/lib
parentb4b3e77d109bd804510223273c25779d52347959 (diff)
downloadPeerTube-8e8234abba7b64767e9ffb6dc38758a62b1ea16c.tar.gz
PeerTube-8e8234abba7b64767e9ffb6dc38758a62b1ea16c.tar.zst
PeerTube-8e8234abba7b64767e9ffb6dc38758a62b1ea16c.zip
Improve logging when cannot fetch remote videos
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos.ts15
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
178async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentObject | string, actor?: ActorModel) { 178async 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 = {