     (if (string? match)
       (= match name)
       (re-find match name))))
-
-(def metadata-edn "_metadata.edn")
 
 (defn find-artifacts
   ([dir]

  (let [filename (if (string? file) file (.getName file))]
    (.endsWith filename ".pom")))

(defn find-upload-dir [{:keys [upload-dir]}]
  (let [dir (io/file upload-dir)]
    (if (and dir (.exists dir))
      dir
      (let [dir' (io/file (FileUtils/getTempDirectory)
                   (str "upload-" (UUID/randomUUID)))]
        (FileUtils/forceMkdir dir')
        dir'))))

(defn upload-request [db groupname session f]
  (with-account
    (fn [account]
      (let [upload-dir (find-upload-dir session)]
        (require-authorization db account groupname (partial f account upload-dir))
        ;; should we only do 201 if the file didn't already exist?
        {:status 201
         :headers {}
         :session (assoc session :upload-dir (.getAbsolutePath upload-dir))
         :body nil}))))

(defn find-pom [dir]

                  (throw-invalid (str "invalid pom file: " (.getMessage e))
                    {:file pom-file}
                    e)))
          {:keys [group group-path name] :as posted-metadata} (read-metadata dir)]

      ;; since we trigger on maven-metadata.xml, we don't actually
      ;; have the sums for it because they are uploaded *after* the
