Skip to content
Snippets Groups Projects
Commit 89b514d1 authored by Maki Nishifuji's avatar Maki Nishifuji
Browse files

Add detection mime-types for upload files

Eliminate OS dependence from mime-types. e.g. `foo.csv` is
`text/csv` on Linux, but `application/vnd.ms-excel` on Windows 7.
parent 896984c2
No related branches found
No related tags found
No related merge requests found
import toastr from 'toastr'
import mime from 'mime-type/with-db'
katexSyntax = ->
if RocketChat.katex.katex_enabled()
return "$$KaTeX$$" if RocketChat.katex.dollar_syntax_enabled()
......@@ -192,6 +194,8 @@ Template.messageBox.events
filesToUpload = []
for file in files
# `file.type = mime.lookup(file.name)` does not work.
Object.defineProperty(file, 'type', { value: mime.lookup(file.name) })
filesToUpload.push
file: file
name: file.name
......
import moment from 'moment'
import mime from 'mime-type/with-db'
socialSharing = (options = {}) ->
window.plugins.socialsharing.share(options.message, options.subject, options.file, options.link)
......@@ -407,6 +408,8 @@ Template.room.events
filesToUpload = []
for file in files
# `file.type = mime.lookup(file.name)` does not work.
Object.defineProperty(file, 'type', { value: mime.lookup(file.name) })
filesToUpload.push
file: file
name: file.name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment