- if (type.indexOf("image") > -1 ||
- type.indexOf("audio") > -1 ||
- type.indexOf("text") > -1 ||
- type.indexOf("video") > -1)
+ if (type.startsWith('image/') ||
+ type.startsWith('audio') ||
+ type.startsWith('text/plain') ||
+ type.startsWith('video/'))