fireedge: fix serialization for list-multiple user inputs#7742
Open
a9sk wants to merge 1 commit into
Open
Conversation
3155bbf to
4803967
Compare
Signed-off-by: Emiliano Rizzonelli <erizzonelli@fbk.eu>
4803967 to
0a2710b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a serialization bug in the FireEdge UI where
listMultipleuser inputs were being sent to the server as native arrays or duplicate parameter keys.Because the backend XML-RPC/core parser expects a single string for these fields, standard HTTP parameter parsing was overwriting all but the final selected value.
The bug
For a more technical breakdown of the bug, here is how the data flow was breaking down:
list-multipletype;values: ["val1","val2","val3"](to keep ordered));<values>val1</values>,<values>val2</values>,<values>val3</values>);values="val3").Solution
This patch resolves the issue by intercepting the form state right before submission via the
.afterSubmithook in bothUserInputs.jsandutils/schema.js. It transforms the array into a comma-separated string (e.g.,values="val1,val2,val3"), which aligns with how the backend stores and parses these attributes. It also includes an empty-array check to returnundefined, preventing the submission of unintended empty strings for optional fields and stripping the key cleanly from the payload instead.A note on standardization and CLI implementation:
This fix patches the UI to match the backend's current string-based parsing. However, if comma-separated strings are not intended to be the long-term, standardized data structure for
list-multipleattributes, it might make sense to standardize this data type natively across the core API.If this comma-separated solution is intended, please keep this behavior in mind when documenting and eventually implementing
list-multiplesupport for the CLI natively (issue: #7055).Branches to which this PR applies