Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-manager: Fix addrepo from-repofile with empty/comment lines #1671

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 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,12 @@ 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) {
// Skip empty lines and comment lines (ConfigParser stores the empty line and comment line
// in an automatically generated key whose name starts with the '#' character).
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
Loading