Skip to content

Commit

Permalink
Add a formatting exception to prevent rewriting to an invalid expression
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaechler committed Feb 13, 2024
1 parent 37fd568 commit d66c0bb
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ class NodeGroupUnserialisationImpl(
tryo(s.text.toBoolean)
) ?~! ("Missing attribute 'isSystem' in entry type nodeGroup : " + entry)
properties <- traverse((group \ "properties" \ "property").toList) {
// format: off
case <property>{p @ _*}</property> =>
// format: on
val name = (p \\ "name").text.trim
if (name.trim.isEmpty) {
Failure(s"Found unexpected xml under <properties> tag (name is blank): ${p}")
Expand All @@ -286,7 +288,7 @@ class NodeGroupUnserialisationImpl(
)
.toBox
}
case xml => Failure(s"Found unexpected xml under <properties> tag: ${xml}")
case xml => Failure(s"Found unexpected xml under <properties> tag: ${xml}")
}
} yield {
NodeGroup(
Expand Down Expand Up @@ -847,14 +849,16 @@ class ApiAccountUnserialisationImpl extends ApiAccountUnserialisation {
// because the event was saved < Rudder 4.3. Use a "nil" ACL
Full(ApiAuthorization.None)

case Some(Text(ApiAuthorizationKind.RO.name)) =>
case Some(Text(ApiAuthorizationKind.RO.name)) =>
Full(ApiAuthorization.RO)
case Some(Text(ApiAuthorizationKind.RW.name)) =>
case Some(Text(ApiAuthorizationKind.RW.name)) =>
Full(ApiAuthorization.RW)
// format: off
case Some(<acl>{xml @ _*}</acl>) if (xml.nonEmpty) =>
// format: on
unserAcl(xml.head)
// all other case: serialization pb => None
case _ => Full(ApiAuthorization.None)
case _ => Full(ApiAuthorization.None)
}
accountType = (apiAccount \ "kind").headOption.map(_.text) match {
case None => ApiAccountType.PublicApi
Expand Down

0 comments on commit d66c0bb

Please sign in to comment.