From 9e3108f129ed6b56844d77e68e5ddd2565b3ccb7 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 22 Feb 2021 10:56:21 +0000 Subject: [PATCH] Ignore non-yaml files in ID dir --- crev-lib/src/local.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crev-lib/src/local.rs b/crev-lib/src/local.rs index 39feb95f..809cf827 100644 --- a/crev-lib/src/local.rs +++ b/crev-lib/src/local.rs @@ -259,8 +259,11 @@ impl Local { let ids_path = self.user_ids_path(); let mut ids = vec![]; for dir_entry in std::fs::read_dir(&ids_path)? { - let locked_id = LockedId::read_from_yaml_file(&dir_entry?.path())?; - ids.push(locked_id.to_public_id()) + let path = dir_entry?.path(); + if path.extension().map_or(false, |ext| ext == "yaml") { + let locked_id = LockedId::read_from_yaml_file(&path)?; + ids.push(locked_id.to_public_id()) + } } Ok(ids)