Skip to content

Conversation

@jrohel
Copy link
Contributor

@jrohel jrohel commented Nov 5, 2025

The methods to_string and get_value_string in OptionStringContainer were incorrectly using the hardcoded delimiter ", ".

This commit fixes two issues:

  1. Delimiter Usage - The methods now use the first defined delimiter instead of the hardcoded ", ".

  2. Escaping - Delimiters that are part of the value are now escaped with a backslash '\'.

Unit tests are included.

Closes: #2500
Closes: #2501

@jrohel jrohel requested a review from a team as a code owner November 5, 2025 14:57
@jrohel jrohel requested review from m-blaha and removed request for a team November 5, 2025 14:57
@m-blaha m-blaha self-assigned this Nov 5, 2025
}
oss << val;
for (const auto ch : item) {
if (delimiters.find(ch) != delimiters.npos) {
Copy link
Member

@m-blaha m-blaha Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backslash itself should also be escaped. Currently both ["first,second"] and ["first","second"] are serialized as the same string "first\,second".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The backslash character is now properly escaped.
I also updated the method docstring and modified unit tests to cover backslash escaping.

The methods to_string() and get_value_string() in OptionStringContainer
were incorrectly using the hardcoded delimiter ", ".

This commit fixes two issues:

1. Delimiter Usage - The methods now use the first defined delimiter
   instead of the hardcoded ", ".

2. Escaping - Delimiters that are part of the value are now escaped
   with a backslash '\'.
The primary tests call get_value_string, which provides implicit
coverage for the internally called to_string method.
@jrohel jrohel force-pushed the fix_OpitonStringContainer_to_string_delim_and_escape branch from 3f36c89 to be65300 Compare November 6, 2025 11:52
Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@m-blaha m-blaha added this pull request to the merge queue Nov 6, 2025
Merged via the queue into rpm-software-management:main with commit 96d10de Nov 6, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants