summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2019-01-13 18:21:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-01-13 18:21:10 +0900
commit018837db0b9f25eeb554f49185d33e9c3969688f (patch)
tree0188b836c80492f9e3f2d551816259d9153c896d /src
parentMerge branch 'develop' of https://github.com/syuilo/misskey into develop (diff)
downloadmisskey-018837db0b9f25eeb554f49185d33e9c3969688f.tar.gz
misskey-018837db0b9f25eeb554f49185d33e9c3969688f.tar.bz2
misskey-018837db0b9f25eeb554f49185d33e9c3969688f.zip
Support SVG (#3883)
* Update add-file.ts * Update package.json * Revert "Update add-file.ts" This reverts commit ba0fe83b54a44493447208dfb3cc304a60df6fdd. * Update add-file.ts * Update package.json * Update add-file.ts * Update add-file.ts * Create image.svg * Update api.ts
Diffstat (limited to 'src')
-rw-r--r--src/services/drive/add-file.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts
index 2ea8cdc3bd..38b150a639 100644
--- a/src/services/drive/add-file.ts
+++ b/src/services/drive/add-file.ts
@@ -4,10 +4,11 @@ import * as fs from 'fs';
import * as mongodb from 'mongodb';
import * as crypto from 'crypto';
import * as debug from 'debug';
-import fileType = require('file-type');
import * as Minio from 'minio';
import * as uuid from 'uuid';
import * as sharp from 'sharp';
+import * as fileType from 'file-type';
+import * as isSvg from 'is-svg';
import DriveFile, { IMetadata, getDriveFileBucket, IDriveFile } from '../../models/drive-file';
import DriveFolder from '../../models/drive-folder';
@@ -320,6 +321,8 @@ export default async function(
const type = fileType(buffer);
if (type) {
res([type.mime, type.ext]);
+ } else if (isSvg(buffer)) {
+ res(['image/svg+xml', 'svg'])
} else {
// 種類が同定できなかったら application/octet-stream にする
res(['application/octet-stream', null]);