Minor fixes around images

This commit is contained in:
Bryan Ashby 2023-04-10 13:18:06 -06:00
parent 0b59d0e3b5
commit 84c6478849
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
2 changed files with 5 additions and 4 deletions

View File

@ -98,7 +98,8 @@ module.exports = class Actor extends ActivityPubObject {
const url = userSettings[t];
if (url) {
const fn = paths.basename(url);
const mt = mimeTypes.contentType(fn);
const mt =
mimeTypes.contentType(fn) || mimeTypes.contentType('dummy.png');
if (mt) {
o[t] = {
mediaType: mt,

View File

@ -16,7 +16,7 @@ const fs = require('graceful-fs');
const paths = require('path');
const moment = require('moment');
const { encode, decode } = require('html-entities');
const { isString } = require('lodash');
const { isString, get } = require('lodash');
const { stripHtml } = require('string-strip-html');
exports.getActorId = o => o.actor?.id || o.actor;
@ -152,8 +152,8 @@ function getUserProfileTemplatedBody(
OUTBOX: userAsActor.outbox,
FOLLOWERS: userAsActor.followers,
FOLLOWING: userAsActor.following,
USER_ICON: userAsActor.icon.url,
USER_IMAGE: userAsActor.image.url,
USER_ICON: get(userAsActor, 'icon.url', ''),
USER_IMAGE: get(userAsActor, 'image.url', ''),
PREFERRED_USERNAME: userAsActor.preferredUsername,
NAME: userAsActor.name,
SEX: user.getProperty(UserProps.Sex),