Fix create_metadata output#229
Merged
Merged
Conversation
The upgrade to `xmlbuilder2` broke some generated XMLs, the metadata is part of them as of [AuthNRequest](#227 (comment)), there is probably more if the XML is build with arrays. Explanation, given this code: ``` root.ele({ number: [ "one", "two", { three: { "@Val": 3 } } ] }); ``` `xmlbuilder` used to [render array like that](https://github.com/oozcitak/xmlbuilder-js/wiki/Conversion-From-Object#arrays): ``` <number> <one/> <two/> <three val="3"/> </number> ``` And `xmlbuilder2` now [renders them like that](https://oozcitak.github.io/xmlbuilder2/object-conversion.html): ``` <number>one</number> <number>two</number> <number> <three val="3"/> </number> ``` There was the flag `separateArrayItems` in `xmlbuilder` to change the behavior but I do not see it in `xmlbuilder2`.
Member
|
Ah, yikes! Thanks for the speedy PR; I thought test cases properly covered all of the Can we create a case for EDIT: working on a test case for this currently. |
When we upgraded to xmlbuilder2, the method we were using to create XML documents slightly changed. See 57b1486 and c910edb for more context. This change explicitly checks for the amount of nodes that refer to SPSSODescriptors. Before we upgraded xmlbuilder, there should only be one. When we upgraded to xmlbuilder2, it registered 5. With this change to create_metadata, it is now 1 again.
Contributor
Author
|
I think the update to xmlbuilder2 also removed some non essential properties, like on the keys nodes. I did not investigate that. |
Member
|
That's really unfortunate. I'm going to reopen that as an issue to check, and work on that separate from this immediate PR. If you believe the test case covers the regression, I'd be happy to merge this in. |
Contributor
Author
|
The test case should do it. I feel like the best would probably be to compare the output with an expected string. But maybe that's for another issue 😉 |
manicphase
pushed a commit
to manicphase/peertube-official-plugins
that referenced
this pull request
Jul 27, 2022
…e XML output. This can be restored when this PR is merged: Clever/saml2#229
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.
The upgrade to
xmlbuilder2broke some generated XMLs, the metadata is part of them as of AuthNRequest, there is probably more if the XML is build with arrays.Explanation:
Given this code:
xmlbuilderused to render array like that:And
xmlbuilder2now renders them like that:There was the flag
separateArrayItemsinxmlbuilderto change the behavior but I do not see it inxmlbuilder2. The only option seems to fix all XMLs generation code if it uses arrays.