diff options
Diffstat (limited to 'server/lib/activitypub/actor.ts')
-rw-r--r-- | server/lib/activitypub/actor.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 52b6c1f56..3c9a7ba02 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -14,7 +14,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp | |||
14 | import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' | 14 | import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' |
15 | import { logger } from '../../helpers/logger' | 15 | import { logger } from '../../helpers/logger' |
16 | import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto' | 16 | import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto' |
17 | import { doJSONRequest } from '../../helpers/requests' | 17 | import { doJSONRequest, PeerTubeRequestError } from '../../helpers/requests' |
18 | import { getUrlFromWebfinger } from '../../helpers/webfinger' | 18 | import { getUrlFromWebfinger } from '../../helpers/webfinger' |
19 | import { MIMETYPES, WEBSERVER } from '../../initializers/constants' | 19 | import { MIMETYPES, WEBSERVER } from '../../initializers/constants' |
20 | import { sequelizeTypescript } from '../../initializers/database' | 20 | import { sequelizeTypescript } from '../../initializers/database' |
@@ -279,16 +279,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel | |||
279 | actorUrl = actor.url | 279 | actorUrl = actor.url |
280 | } | 280 | } |
281 | 281 | ||
282 | const { result, statusCode } = await fetchRemoteActor(actorUrl) | 282 | const { result } = await fetchRemoteActor(actorUrl) |
283 | |||
284 | if (statusCode === HttpStatusCode.NOT_FOUND_404) { | ||
285 | logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) | ||
286 | actor.Account | ||
287 | ? await actor.Account.destroy() | ||
288 | : await actor.VideoChannel.destroy() | ||
289 | |||
290 | return { actor: undefined, refreshed: false } | ||
291 | } | ||
292 | 283 | ||
293 | if (result === undefined) { | 284 | if (result === undefined) { |
294 | logger.warn('Cannot fetch remote actor in refresh actor.') | 285 | logger.warn('Cannot fetch remote actor in refresh actor.') |
@@ -328,6 +319,15 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel | |||
328 | return { refreshed: true, actor } | 319 | return { refreshed: true, actor } |
329 | }) | 320 | }) |
330 | } catch (err) { | 321 | } catch (err) { |
322 | if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { | ||
323 | logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) | ||
324 | actor.Account | ||
325 | ? await actor.Account.destroy() | ||
326 | : await actor.VideoChannel.destroy() | ||
327 | |||
328 | return { actor: undefined, refreshed: false } | ||
329 | } | ||
330 | |||
331 | logger.warn('Cannot refresh actor %s.', actor.url, { err }) | 331 | logger.warn('Cannot refresh actor %s.', actor.url, { err }) |
332 | return { actor, refreshed: false } | 332 | return { actor, refreshed: false } |
333 | } | 333 | } |