summaryrefslogtreecommitdiffstats
path: root/net/src
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-10 10:21:49 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-10 10:21:49 +0200
commit50b3f08d05c259433e31c6e749ceaa72cfbc0584 (patch)
treebd1d764f8fafd7f72ce7cde124189cae58827d2f /net/src
parentf207cf74e99469cf7d967e4e8829c6e0e2f84432 (diff)
net: Improve error handling.
Diffstat (limited to 'net/src')
-rw-r--r--net/src/wkd.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/src/wkd.rs b/net/src/wkd.rs
index 95d59f42..4359e975 100644
--- a/net/src/wkd.rs
+++ b/net/src/wkd.rs
@@ -230,6 +230,10 @@ pub(crate) fn parse_body<S: AsRef<str>>(body: &[u8], email_address: S)
let packets = TPKParser::from_bytes(&body)?;
// Collect only the correct packets.
let tpks: Vec<TPK> = packets.flatten().collect();
+ if tpks.is_empty() {
+ return Err(Error::NotFound.into());
+ }
+
// Collect only the TPKs that contain the email in any of their userids
let valid_tpks: Vec<TPK> = tpks.iter()
// XXX: This filter could become a TPK method, but it adds other API