Skip to content

Commit

Permalink
Don't require checksums for signature files
Browse files Browse the repository at this point in the history
Fixes #859.
  • Loading branch information
tobias committed Apr 12, 2023
1 parent 2d80037 commit 562c798
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/clojars/file_utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
([file type]
(valid-checksum-file? file type true))
([file type fail-if-missing?]
(let [sig-file (checksum-file file type)]
(if (.exists sig-file)
(valid-checksum? (slurp sig-file) file type)
(let [sum-file (checksum-file file type)]
(if (.exists sum-file)
(valid-checksum? (slurp sum-file) file type)
(not fail-if-missing?)))))

(defn group->path [group]
Expand Down
7 changes: 5 additions & 2 deletions src/clojars/routes/repo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@
(defn validate-checksums [artifacts]
(doseq [f artifacts]
;; verify that at least one type of checksum file exists
(when (not (or (.exists (fu/checksum-file f :md5))
(.exists (fu/checksum-file f :sha1))))
(when (and (not (or (.exists (fu/checksum-file f :md5))
(.exists (fu/checksum-file f :sha1))))
;; Aether by default no longer checksums signature files, so we don't
;; throw if it is missing
(not (match-file-name #"\.asc$" f)))
(throw-invalid :file-missing-checksum
(format "no checksums provided for %s" (.getName f))
{:file f}))
Expand Down

0 comments on commit 562c798

Please sign in to comment.