aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/actors/shared/object-to-model-attributes.ts40
1 files changed, 21 insertions, 19 deletions
diff --git a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
index f6a78c457..d854bf2b5 100644
--- a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
+++ b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
@@ -35,31 +35,33 @@ function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImag
35 ? actorObject.icons || actorObject.icon 35 ? actorObject.icons || actorObject.icon
36 : actorObject.image 36 : actorObject.image
37 37
38 return normalizeIconOrImage(iconsOrImages).map(iconOrImage => { 38 return normalizeIconOrImage(iconsOrImages)
39 const mimetypes = MIMETYPES.IMAGE 39 .map(iconOrImage => {
40 const mimetypes = MIMETYPES.IMAGE
40 41
41 if (iconOrImage.type !== 'Image' || !isActivityPubUrlValid(iconOrImage.url)) return undefined 42 if (iconOrImage.type !== 'Image' || !isActivityPubUrlValid(iconOrImage.url)) return undefined
42 43
43 let extension: string 44 let extension: string
44 45
45 if (iconOrImage.mediaType) { 46 if (iconOrImage.mediaType) {
46 extension = mimetypes.MIMETYPE_EXT[iconOrImage.mediaType] 47 extension = mimetypes.MIMETYPE_EXT[iconOrImage.mediaType]
47 } else { 48 } else {
48 const tmp = getLowercaseExtension(iconOrImage.url) 49 const tmp = getLowercaseExtension(iconOrImage.url)
49 50
50 if (mimetypes.EXT_MIMETYPE[tmp] !== undefined) extension = tmp 51 if (mimetypes.EXT_MIMETYPE[tmp] !== undefined) extension = tmp
51 } 52 }
52 53
53 if (!extension) return undefined 54 if (!extension) return undefined
54 55
55 return { 56 return {
56 name: buildUUID() + extension, 57 name: buildUUID() + extension,
57 fileUrl: iconOrImage.url, 58 fileUrl: iconOrImage.url,
58 height: iconOrImage.height, 59 height: iconOrImage.height,
59 width: iconOrImage.width, 60 width: iconOrImage.width,
60 type 61 type
61 } 62 }
62 }) 63 })
64 .filter(i => !!i)
63} 65}
64 66
65function getActorDisplayNameFromObject (actorObject: ActivityPubActor) { 67function getActorDisplayNameFromObject (actorObject: ActivityPubActor) {