mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
publish: Do not publish nars for invalid store items.
Before that, /nar requests could succeed if the requested store item exists but is invalid (although such requests were unlikely because the corresponding narinfo request would have failed.) * guix/scripts/publish.scm (render-nar): Add 'store' parameter. Use 'valid-path?' instead of 'file-exists?'. (make-request-handler): Adjust 'render-nar' call accordingly. * tests/publish.scm ("/nar/invalid"): New test.
This commit is contained in:
parent
a65e2a02fc
commit
0043558082
2 changed files with 11 additions and 3 deletions
|
@ -112,6 +112,14 @@ References: ~a~%"
|
|||
(call-with-input-string nar (cut restore-file <> temp)))
|
||||
(call-with-input-file temp read-string))))
|
||||
|
||||
(test-equal "/nar/invalid"
|
||||
404
|
||||
(begin
|
||||
(call-with-output-file (string-append (%store-prefix) "/invalid")
|
||||
(lambda (port)
|
||||
(display "This file is not a valid store item." port)))
|
||||
(response-code (http-get (publish-uri (string-append "/nar/invalid"))))))
|
||||
|
||||
(test-end "publish")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue