projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c6de3a8
)
Correctly check remote extension
author
Chocobozzz
<me@florianbigard.com>
Wed, 12 Feb 2020 09:26:35 +0000
(10:26 +0100)
committer
Chocobozzz
<me@florianbigard.com>
Wed, 12 Feb 2020 09:26:35 +0000
(10:26 +0100)
server/lib/activitypub/actor.ts
patch
|
blob
|
history
diff --git
a/server/lib/activitypub/actor.ts
b/server/lib/activitypub/actor.ts
index 8c5c618fc2e8ff80125fb9e5492eac220f0c7d91..fd934443b8dd19725db0c495dd509443da6c5b25 100644
(file)
--- 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