Skip to content

Commit e9fc578

Browse files
committed
fix: syntax error
1 parent 0f40e96 commit e9fc578

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

rust/catalyst-signed-doc-macro/src/rules/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub(crate) fn catalyst_signed_documents_rules_impl() -> anyhow::Result<TokenStre
2222
id: crate::validator::rules::IdRule,
2323
ver: crate::validator::rules::VerRule,
2424
content_type: crate::validator::rules::ContentTypeRule::NotSpecified,
25-
content_encoding: crate::validator::rules::ContentEncodingRule {
25+
content_encoding: crate::validator::rules::ContentEncodingRule::Specified {
2626
exp: ContentEncoding::Brotli,
2727
optional: false,
2828
},

rust/signed_doc/src/validator/rules/content_type.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,23 @@ impl ContentTypeRule {
4747
);
4848
return Ok(false);
4949
}
50+
let Ok(content) = doc.decoded_content() else {
51+
doc.report().functional_validation(
52+
"Invalid Document content, cannot get decoded bytes",
53+
"Cannot get a document content during the content type field validation",
54+
);
55+
return Ok(false);
56+
};
57+
if self.validate(&content).is_err() {
58+
doc.report().invalid_value(
59+
"payload",
60+
&hex::encode(content),
61+
&format!("Invalid Document content, should {content_type} encodable"),
62+
"Invalid Document content",
63+
);
64+
return Ok(false);
65+
}
5066
}
51-
let Ok(content) = doc.decoded_content() else {
52-
doc.report().functional_validation(
53-
"Invalid Document content, cannot get decoded bytes",
54-
"Cannot get a document content during the content type field validation",
55-
);
56-
return Ok(false);
57-
};
58-
if self.validate(&content).is_err() {
59-
doc.report().invalid_value(
60-
"payload",
61-
&hex::encode(content),
62-
&format!("Invalid Document content, should {content_type} encodable"),
63-
"Invalid Document content",
64-
);
65-
return Ok(false);
66-
}
67-
6867
Ok(true)
6968
}
7069

0 commit comments

Comments
 (0)