                           :version version}
                     file (io/file (config :repo) group
                                   artifact version filename)]
+                ;;TODO once db is removed this whole if block
+                ;;can be reduced to the common
+                ;;(try (save-to-file...) (catch ...))
                 (if (.endsWith filename ".pom")
                   (let [contents (slurp body)
                         pom-info (merge (maven/pom-to-map
                                          (StringReader. contents)) info)]
-                    (if (find-jar groupname artifact version)
+                    (if (find-jar group artifact version)
                       (update-jar account pom-info)
                       (add-jar account pom-info))
                     (try

                        (.delete file)
                        (throw e))))
                  (do
                    (when-not (find-jar groupname artifact version)
                      (add-jar account info))
                    (try
                      (save-to-file file body)
                      (catch java.io.IOException e
                        (.delete file)
                        (throw e)))))
                (ev/record-deploy {:group groupname
                                   :artifact-id artifact
                                   :version version} account file))
              {:status 201 :headers {} :body nil}
              (catch Exception e
                (pst e)

  ([group-id artifact-id]
     (find-jar group-id artifact-id (first (versions group-id artifact-id))))
  ([group-id artifact-id version]
     (try
       (maven/pom-to-map (io/file (config :repo) group-id artifact-id version
                                  (format "%s-%s.%s" artifact-id version "pom")))
       (catch java.io.FileNotFoundException e
         nil))))

(defn group-artifacts [group-id]
  (.list (io/file (config :repo) group-id)))
