aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-12 10:26:35 +0100
committerChocobozzz <me@florianbigard.com>2020-02-12 10:26:35 +0100
commit5224f71303b2201f7a744f74241d16d805cba5f1 (patch)
tree2c39e73adc77502f3492eadd979b53e9ea7b138e /server
parentc6de3a85eebbdef3029769ea6225277419ffbe00 (diff)
downloadPeerTube-5224f71303b2201f7a744f74241d16d805cba5f1.tar.gz
PeerTube-5224f71303b2201f7a744f74241d16d805cba5f1.tar.zst
PeerTube-5224f71303b2201f7a744f74241d16d805cba5f1.zip
Correctly check remote extension
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/actor.ts12
1 files changed, 9 insertions, 3 deletions
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) {
221 221
222 if (!icon || icon.type !== 'Image' || !isActivityPubUrlValid(icon.url)) return undefined 222 if (!icon || icon.type !== 'Image' || !isActivityPubUrlValid(icon.url)) return undefined
223 223
224 const extension = icon.mediaType 224 let extension: string
225 ? mimetypes.MIMETYPE_EXT[icon.mediaType] 225
226 : extname(icon.url) 226 if (icon.mediaType) {
227 extension = mimetypes.MIMETYPE_EXT[icon.mediaType]
228 } else {
229 const tmp = extname(icon.url)
230
231 if (mimetypes.EXT_MIMETYPE[tmp] !== undefined) extension = tmp
232 }
227 233
228 if (!extension) return undefined 234 if (!extension) return undefined
229 235