             [ring.util.response :as response])
   (:import java.io.StringReader))
 
-(defn save-to-file [sent-file body]
+(defn save-to-file [sent-file input]
   (-> sent-file
       .getParentFile
       .mkdirs)
-  (spit sent-file body))
+  (io/copy input sent-file))
 
 (defroutes routes
   (PUT ["/:group/:artifact/:file"

                                    {:group groupname
                                     :name  artifact
                                     :version version})))
                (when-not (find-jar groupname artifact version)
                  (add-jar account  {:group groupname
                                     :name  artifact
                                     :version version})))
              (save-to-file (io/file (config :repo) group artifact version file)
                            contents))
            {:status 201 :headers {} :body nil})))))

(defn wrap-file-at [app dir prefix]

         (authorized!
          (string/replace group "/" ".")
          (save-to-file (io/file (config :repo) group artifact file)
                        body)
          {:status 201 :headers {} :body nil})))
  (PUT ["/:group/:artifact/:version/:file"
        :group #".+" :artifact #"[^/]+" :version #"[^/]+" :file #"[^/]+"]
