Avoid an artificial error scenario

This commit is contained in:
Oliver Hamlet
2025-07-22 19:56:15 +01:00
parent 1c6910e335
commit ea48f5d14e
2 changed files with 8 additions and 9 deletions
+1 -9
View File
@@ -117,15 +117,7 @@ impl Database {
let mut doc = MetadataDocument::default();
for plugin in self.masterlist.plugins_iter() {
let Ok(mut minimal_plugin) = PluginMetadata::new(plugin.name()) else {
// This should never happen because the regex plugin name from
// an existing PluginMetadata object should be valid.
logging::error!(
"Unexpectedly encountered a regex error trying to create a PluginMetadata object with the name {}",
plugin.name()
);
continue;
};
let mut minimal_plugin = PluginMetadata::with_same_name(plugin);
minimal_plugin.set_tags(plugin.tags().to_vec());
minimal_plugin.set_dirty_info(plugin.dirty_info().to_vec());
+7
View File
@@ -45,6 +45,13 @@ impl PluginMetadata {
})
}
pub(crate) fn with_same_name(metadata: &PluginMetadata) -> Self {
Self {
name: metadata.name.clone(),
..Default::default()
}
}
/// Get the plugin name.
pub fn name(&self) -> &str {
self.name.as_str()