From 7ad0b1f55550c186522781737967d819b58a761b Mon Sep 17 00:00:00 2001
From: Andrey Antukh <niwi@niwi.nz>
Date: Wed, 12 Oct 2016 19:22:34 +0200
Subject: [PATCH] Send mimetype on image upload.

---
 src/uxbox/main/data/images.cljs | 1 +
 src/uxbox/main/repo/images.cljs | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/uxbox/main/data/images.cljs b/src/uxbox/main/data/images.cljs
index 3acc9499a..422bb7b43 100644
--- a/src/uxbox/main/data/images.cljs
+++ b/src/uxbox/main/data/images.cljs
@@ -203,6 +203,7 @@
               (contains? allowed-file-types (.-type file)))
             (prepare [[file [width height]]]
               {:coll coll-id
+               :mimetype (.-type file)
                :id (uuid/random)
                :file file
                :width width
diff --git a/src/uxbox/main/repo/images.cljs b/src/uxbox/main/repo/images.cljs
index 160419718..f0021b6ea 100644
--- a/src/uxbox/main/repo/images.cljs
+++ b/src/uxbox/main/repo/images.cljs
@@ -45,8 +45,10 @@
     (send! params)))
 
 (defmethod request :create/image
-  [_ {:keys [coll id file width height] :as body}]
+  [_ {:keys [coll id file width height mimetype] :as body}]
   (let [body (doto (js/FormData.)
+               (.append "mimetype" mimetype)
+               ;; (.append "collection" (str coll))
                (.append "file" file)
                (.append "width" width)
                (.append "height" height)