From: Chocobozzz Date: Wed, 12 Feb 2020 09:26:35 +0000 (+0100) Subject: Correctly check remote extension X-Git-Tag: v2.2.0-rc.1~499 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5224f71303b2201f7a744f74241d16d805cba5f1;p=oweals%2Fpeertube.git Correctly check remote extension --- diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 8c5c618fc..fd934443b 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -221,9 +221,15 @@ function getAvatarInfoIfExists (actorJSON: ActivityPubActor) { if (!icon || icon.type !== 'Image' || !isActivityPubUrlValid(icon.url)) return undefined - const extension = icon.mediaType - ? mimetypes.MIMETYPE_EXT[icon.mediaType] - : extname(icon.url) + let extension: string + + if (icon.mediaType) { + extension = mimetypes.MIMETYPE_EXT[icon.mediaType] + } else { + const tmp = extname(icon.url) + + if (mimetypes.EXT_MIMETYPE[tmp] !== undefined) extension = tmp + } if (!extension) return undefined