Skip to content

Commit

Permalink
fix bug in protobuf code introduced by #1452
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
  • Loading branch information
cdisselkoen committed Feb 11, 2025
1 parent bef0b31 commit aeab553
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cedar-policy/src/proto/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl From<&ast::EntityUID> for models::EntityUid {
fn from(v: &ast::EntityUID) -> Self {
Self {
ty: Some(models::EntityType::from(v.entity_type())),
eid: v.eid().escaped().into(),
eid: <ast::Eid as AsRef<str>>::as_ref(v.eid()).into(),
}
}
}
Expand Down Expand Up @@ -727,6 +727,16 @@ mod test {
ast::EntityUID::from(&models::EntityUid::from(&euid2))
);

let euid3 = ast::EntityUID::from_components(
ast::EntityType::from_normalized_str("A").unwrap(),
ast::Eid::new("\0\n \' \"+-$^!"),
None,
);
assert_eq!(
euid3,
ast::EntityUID::from(&models::EntityUid::from(&euid3))
);

let attrs = (1..=7)
.map(|id| (format!("{id}").into(), ast::RestrictedExpr::val(true)))
.collect::<HashMap<SmolStr, _>>();
Expand Down

0 comments on commit aeab553

Please sign in to comment.