Skip to content

Commit 0934f16

Browse files
committed
Fix: Only consider fragment files
The previous implementation did consider non-changelog-fragment-files as well, which is not what we want here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 parent 65bdab4 commit 0934f16

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/command/verify_metadata_command.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ impl crate::command::Command for VerifyMetadataCommand {
2525
Ok(de) => de.path().is_file().then(|| de.path().to_path_buf()).map(Ok),
2626
Err(e) => Some(Err(e)),
2727
})
28-
.map(|rde| -> Result<_, Error> {
29-
let de = rde.map_err(VerificationError::from)?;
28+
.filter_map(|rde| {
29+
let de = match rde {
30+
Err(e) => return Some(Err(Error::from(VerificationError::from(e)))),
31+
Ok(de) => de,
32+
};
3033
let path = de.as_path();
3134
log::trace!("Looking at {}", path.display());
3235

33-
if crate::command::common::get_version_from_path(path)
34-
.map_err(VerificationError::from)?
35-
.is_none()
36-
{
37-
log::warn!("No version: {}", path.display());
36+
match crate::command::common::get_version_from_path(path).map_err(VerificationError::from) {
37+
Err(e) => return Some(Err(Error::from(e))),
38+
Ok(None) => return None,
39+
Ok(_some) => {
40+
// nothing
41+
}
3842
}
3943

40-
std::fs::OpenOptions::new()
44+
let res = std::fs::OpenOptions::new()
4145
.read(true)
4246
.create(false)
4347
.write(false)
@@ -58,7 +62,9 @@ impl crate::command::Command for VerifyMetadataCommand {
5862
multiple: errors,
5963
})
6064
})
61-
.map_err(|ve| Error::Verification(ve))
65+
.map_err(|ve| Error::Verification(ve));
66+
67+
Some(res)
6268
})
6369
.partition_result();
6470

0 commit comments

Comments
 (0)