Create and merge array from (multi-valued) attributes #307
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.
When consuming attributes from headers instead of env, multi-valued attributes are sometimes header name postfixed (_01, _02) or merged using a separator. The former can not easily be solved without extra logic, but the latter can be exploded using the separator character. The advantage is that everything will now be cast into an array, so that values can always be array_merged. Even multi separator-merged-multi-valued attributes will result in the correct multi-valued value this way.
This will solve #293
TODO: I lack the time and Nextcloud app development experience to introduce a separator setting in UI.
Please add one before merging this PR.
Just make sure to replace an empty separator "" with "\0" so that explode still works and strings aren't unexpectedly cut into smaller pieces. \0 should not naturally occur in strings.