Correctly check remote extension

This commit is contained in:
Chocobozzz 2020-02-12 10:26:35 +01:00
parent c6de3a85ee
commit 5224f71303
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 3 deletions

View File

@ -221,9 +221,15 @@ function getAvatarInfoIfExists (actorJSON: ActivityPubActor) {
if (!icon || icon.type !== 'Image' || !isActivityPubUrlValid(icon.url)) return undefined if (!icon || icon.type !== 'Image' || !isActivityPubUrlValid(icon.url)) return undefined
const extension = icon.mediaType let extension: string
? mimetypes.MIMETYPE_EXT[icon.mediaType]
: extname(icon.url) 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 if (!extension) return undefined