Skip to content

Commit

Permalink
config-manager: Fix addrepo from-repofile with empty/comment lines
Browse files Browse the repository at this point in the history
Comments and blank lines were interpreted as options
in the configuration file validity test. Now they are ignored.
  • Loading branch information
jrohel committed Sep 3, 2024
1 parent 58cfa3f commit 200d2f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dnf5-plugins/config-manager_plugin/addrepo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ void ConfigManagerAddRepoCommand::add_repos_from_repofile(
// Test if the repository options can be set.
for (const auto & [repo_id, repo_opts] : parser.get_data()) {
for (const auto & [key, key_val] : repo_opts) {
if (key.starts_with("#")) {
continue;
}
try {
tmp_repo_conf.opt_binds().at(key).new_string(Option::Priority::RUNTIME, key_val);
} catch (const Error & ex) {
Expand Down

0 comments on commit 200d2f3

Please sign in to comment.