Fix deleting not found remote actors
authorChocobozzz <me@florianbigard.com>
Mon, 14 Jan 2019 11:11:06 +0000 (12:11 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 14 Jan 2019 11:11:06 +0000 (12:11 +0100)
server/lib/activitypub/actor.ts

index d728c81d1970de0268a00427ebee13796507d4fe..edf38bc0a58a2dc0aa9104e725aa23f1fca0381d 100644 (file)
@@ -211,7 +211,14 @@ async function refreshActorIfNeeded (
   const actor = fetchedType === 'all' ? actorArg : await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url)
 
   try {
-    const actorUrl = await getUrlFromWebfinger(actor.preferredUsername + '@' + actor.getHost())
+    let actorUrl: string
+    try {
+      actorUrl = await getUrlFromWebfinger(actor.preferredUsername + '@' + actor.getHost())
+    } catch (err) {
+      logger.warn('Cannot get actor URL from webfinger, keeping the old one.', err)
+      actorUrl = actor.url
+    }
+
     const { result, statusCode } = await fetchRemoteActor(actorUrl)
 
     if (statusCode === 404) {
@@ -429,5 +436,3 @@ async function saveVideoChannel (actor: ActorModel, result: FetchRemoteActorResu
 
   return videoChannelCreated
 }
-
-