diff options
| author | Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> | 2020-01-07 23:34:17 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-01-07 23:34:17 +0900 |
| commit | 8aafafe416f6a511a60728ec8859ab0a9df711ad (patch) | |
| tree | 3115f9cfffa087bab35c1535add1bfa85b54d7e3 /src/misc | |
| parent | 11.37.0 (diff) | |
| download | sharkey-8aafafe416f6a511a60728ec8859ab0a9df711ad.tar.gz sharkey-8aafafe416f6a511a60728ec8859ab0a9df711ad.tar.bz2 sharkey-8aafafe416f6a511a60728ec8859ab0a9df711ad.zip | |
Fix #5688 (#5689)
* Resolve #5688
* あああああ
* :innocent:
* :thinking_face:
* Update detect-mine.ts
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'src/misc')
| -rw-r--r-- | src/misc/detect-mine.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/misc/detect-mine.ts b/src/misc/detect-mine.ts index b228733697..f47f127353 100644 --- a/src/misc/detect-mine.ts +++ b/src/misc/detect-mine.ts @@ -1,15 +1,15 @@ import * as fs from 'fs'; -import fileType = require('file-type'); import checkSvg from '../misc/check-svg'; +const FileType = require('file-type'); export async function detectMine(path: string) { return new Promise<[string, string | null]>((res, rej) => { const readable = fs.createReadStream(path); readable .on('error', rej) - .once('data', (buffer: Buffer) => { + .once('data', async (buffer: Buffer) => { readable.destroy(); - const type = fileType(buffer); + const type = await FileType.fromBuffer(buffer); if (type) { if (type.mime == 'application/xml' && checkSvg(path)) { res(['image/svg+xml', 'svg']); |