nixbld: add some error handling to hydra-binary-cache-store.patch

This commit is contained in:
Astro 2021-02-22 00:17:24 +01:00
parent a16ab7d2de
commit 9d0da9bf44
1 changed files with 27 additions and 0 deletions

View File

@ -222,3 +222,30 @@ index 4276f95a..21ff8a97 100644
--
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