nixbld: add hydra-binary-cache-store.patch that is rebased on hydra-restrictdist.patch #11

Closed
astro wants to merge 3 commits from astro/it-infra:hydra-local-binary-cache into master
1 changed files with 27 additions and 0 deletions
Showing only changes of commit 9d0da9bf44 - Show all commits

View File

@ -222,3 +222,30 @@ index 4276f95a..21ff8a97 100644
-- --
2.29.0 2.29.0
From e20013bff3c92b21bab6e476489a1508df1cf348 Mon Sep 17 00:00:00 2001
From: Astro <astro@spaceboyz.net>
Date: Mon, 22 Feb 2021 00:12:12 +0100
Subject: [PATCH] check if nar not found
---
src/lib/Hydra/Controller/Root.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm
index 6be9f2bc..37464c34 100644
--- a/src/lib/Hydra/Controller/Root.pm
+++ b/src/lib/Hydra/Controller/Root.pm
@@ -326,6 +326,10 @@ sub nar :Local :Args(1) {
$c->response->content_type('application/x-nix-archive');
$path = "/" . $1 . "/nar/$path";
+ if (!-f $path) {
+ return notFound($c, "NAR not found");
+ }
+
my $fh = new IO::Handle;
open $fh, "<:raw", $path;
$c->response->body($fh);
--
2.30.0