                                     {:group groupname
                                      :name  artifact
                                      :version version})))
+                (save-to-file (io/file (config :repo) group artifact version file)
+                              contents))
+              (do
                 (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))
+                                     :version version}))
+                (save-to-file (io/file (config :repo) group artifact version file)
+                              body)))
             {:status 201 :headers {} :body nil})))))
 
 (defn wrap-file-at [app dir prefix]

         (with-account
           (authorized!
            (string/replace group "/" ".")
            (let [contents (slurp body)]
              (if (.endsWith file ".pom")
                (if (find-jar groupname artifact version)
                  (update-jar account
                              (merge

            [ring.util.response :as response])
  (:import java.io.StringReader))

(defn save-to-file [sent-file input]
  (-> sent-file
      .getParentFile
      .mkdirs)
  (io/copy input sent-file))

(defroutes routes
  (PUT ["/:group/:artifact/:file"
