fix: prevent bonkers behavior on PUT (deny_unknown_fields)

This commit is contained in:
Tomáš Mládek 2023-04-02 14:05:57 +02:00
parent 26fd000a46
commit 272aef7b08

View file

@ -332,7 +332,7 @@ pub struct InEntry {
} }
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
#[serde(untagged)] #[serde(untagged, deny_unknown_fields)]
pub enum PutInput { pub enum PutInput {
Entry(InEntry), Entry(InEntry),
EntryList(Vec<Entry>), EntryList(Vec<Entry>),
@ -436,11 +436,7 @@ pub async fn put_object(
let label_entry = match &address { let label_entry = match &address {
Address::Hash(_) | Address::Uuid(_) => None, Address::Hash(_) | Address::Uuid(_) => None,
Address::Attribute(attribute) => Some(Entry { Address::Attribute(_) => None,
entity: address.clone(),
attribute: LABEL_ATTR.to_string(),
value: format!("ATTRIBUTE: {attribute}").into(),
}),
Address::Url(url) => Some(Entry { Address::Url(url) => Some(Entry {
entity: address.clone(), entity: address.clone(),
attribute: LABEL_ATTR.to_string(), attribute: LABEL_ATTR.to_string(),