Use error NoSuchAccessKey in get info request processing (#1293) (#1356)

Fix for https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1293

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1356
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: Roman Ivanov <xatikopro@gmail.com>
Co-committed-by: Roman Ivanov <xatikopro@gmail.com>
This commit is contained in:
Roman Ivanov
2026-02-27 18:11:57 +00:00
committed by Alex
parent f796df8c34
commit 2cfd92e0c3
+3 -1
View File
@@ -76,7 +76,9 @@ impl RequestHandler for GetKeyInfoRequest {
.await?
.into_iter()
.collect::<Vec<_>>();
if candidates.len() != 1 {
if candidates.is_empty() {
return Err(Error::NoSuchAccessKey(search.clone()));
} else if candidates.len() != 1 {
return Err(Error::bad_request(format!(
"{} matching keys",
candidates.len()