Merge branch 'notification-read-api' into swn
This commit is contained in:
@@ -65,7 +65,8 @@ export async function exportCustomEmojis(job: Bull.Job, done: () => void): Promi
|
||||
|
||||
for (const emoji of customEmojis) {
|
||||
const exportId = ulid().toLowerCase();
|
||||
const emojiPath = path + '/' + exportId + '.' + mime.extension(emoji.type);
|
||||
const ext = mime.extension(emoji.type);
|
||||
const emojiPath = path + '/' + exportId + (ext ? '.' + ext : '');
|
||||
fs.writeFileSync(emojiPath, '', 'binary');
|
||||
let downloaded = false;
|
||||
|
||||
|
@@ -19,6 +19,7 @@ export async function proxyMedia(ctx: Koa.Context) {
|
||||
|
||||
const { mime, ext } = await detectType(path);
|
||||
|
||||
if (!mime.startsWith('image/')) throw 403;
|
||||
if (!FILE_TYPE_BROWSERSAFE.includes(mime)) throw 403;
|
||||
|
||||
let image: IImage;
|
||||
|
@@ -161,7 +161,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
}
|
||||
}
|
||||
|
||||
if (!['image/jpeg', 'image/png', 'image/webp'].includes(type)) {
|
||||
if (!['image/jpeg', 'image/png', 'image/webp', 'image/svg+xml'].includes(type)) {
|
||||
logger.debug(`web image and thumbnail not created (not an required file)`);
|
||||
return {
|
||||
webpublic: null,
|
||||
@@ -202,7 +202,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
webpublic = await convertSharpToJpeg(img, 2048, 2048);
|
||||
} else if (['image/webp'].includes(type)) {
|
||||
webpublic = await convertSharpToWebp(img, 2048, 2048);
|
||||
} else if (['image/png'].includes(type)) {
|
||||
} else if (['image/png', 'image/svg+xml'].includes(type)) {
|
||||
webpublic = await convertSharpToPng(img, 2048, 2048);
|
||||
} else {
|
||||
logger.debug(`web image not created (not an required image)`);
|
||||
@@ -221,7 +221,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||
try {
|
||||
if (['image/jpeg', 'image/webp'].includes(type)) {
|
||||
thumbnail = await convertSharpToJpeg(img, 498, 280);
|
||||
} else if (['image/png'].includes(type)) {
|
||||
} else if (['image/png', 'image/svg+xml'].includes(type)) {
|
||||
thumbnail = await convertSharpToPngOrJpeg(img, 498, 280);
|
||||
} else {
|
||||
logger.debug(`thumbnail not created (not an required file)`);
|
||||
|
Reference in New Issue
Block a user