Closed akhilkr128 closed 2 years ago
LOL that's clever :) It could still technically be a problem, but it's less likely to be a problem than a straight ","
or ", "
, so I'm fine with merging as is, which should at least unstick most callers.
It could still technically be a problem
Yes, if a user puts the option values like "apple,
Orange" instead of "apple, Orange" it will create a problem. I have changed the separator value from " ,"
to ",,"
. I think it will be a rare case to give an option's value with two adjacent commas.
Totals | |
---|---|
Change from base Build 5886: | 0.0% |
Covered Lines: | 5055 |
Relevant Lines: | 5895 |
It turns out that some spec changes are needed here. :-)
,,
seems ok, but it's a problem if someone has an empty entry in an array. I'm wondering if it's better to use a non-printable character, specifically 0x1F, which is defined as the "Unit Separator" character (like a "column separator" or "field separator" character) and is made for this purpose (you could also use 0x1E which is the "Record Separator" character, but I usually think of that more like a "row separator")
Can you please also add a spec demonstrating that this fixes the problem from the issue? (i.e. a string with embedded commas)?
Can you please also add a spec demonstrating that this fixes the problem from the issue? (i.e. a string with embedded commas)?
Sure
Changes done.
Found one minor thing, but overall LGTM.
Backported to morphy
in commit 3bdae46d7efd464a22409df617e969fb160d5b58.
commit 3bdae46d7efd464a22409df617e969fb160d5b58
Author: Jason Frey <fryguy9@gmail.com>
Date: Mon Oct 25 09:50:50 2021 -0400
Merge pull request #484 from akhilkr128/multi_select_array_bug
Bug with handling of Arrays in Automate #480
(cherry picked from commit c75b6f543cb973772f5097ac12235c81fd4d7fdb)
This PR aims to fix the issue - https://github.com/ManageIQ/manageiq-automation_engine/issues/480
backport: also include https://github.com/ManageIQ/manageiq/pull/21520
After the change-
After spending lots of hours on regex to match the scenarios of wrapping special characters around the option values, I came to sense. I realized that array elements could be stored and retrieved with this small change without worrying about the special characters.