File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 2
2
const fs = require ( 'fs' )
3
3
const path = require ( 'path' )
4
4
const bodyParser = require ( 'body-parser' )
5
+ const mime = require ( 'mime-types' )
5
6
6
7
exports . isSQLite = function isSQLite ( sequelize ) {
7
8
return sequelize . options . dialect === 'sqlite'
8
9
}
9
10
10
11
exports . getImageMimeType = function getImageMimeType ( imagePath ) {
11
- const fileExtension = / [ ^ . ] + $ / . exec ( imagePath )
12
-
13
- switch ( fileExtension [ 0 ] ) {
14
- case 'bmp' :
15
- return 'image/bmp'
16
- case 'gif' :
17
- return 'image/gif'
18
- case 'jpg' :
19
- case 'jpeg' :
20
- return 'image/jpeg'
21
- case 'png' :
22
- return 'image/png'
23
- case 'tiff' :
24
- return 'image/tiff'
25
- default :
26
- return undefined
27
- }
12
+ return mime . contentType ( path . extname ( imagePath ) )
28
13
}
29
14
30
15
exports . isRevealTheme = function isRevealTheme ( theme ) {
You can’t perform that action at this time.
0 commit comments