Skip to content

Commit aa296cb

Browse files
committed
fix: not specified
1 parent d89cfaa commit aa296cb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ impl ContentTypeRule {
1919
&self,
2020
doc: &CatalystSignedDocument,
2121
) -> anyhow::Result<bool> {
22+
if let Self::NotSpecified = &self {
23+
if let Ok(content_type) = doc.doc_meta().content_type() {
24+
doc.report().unknown_field(
25+
"content-type",
26+
&content_type.to_string().as_str(),
27+
&format!("document does not expect to have the content type field"),
28+
);
29+
return Ok(false);
30+
}
31+
}
2232
if let Self::Specified { exp } = &self {
2333
let Ok(content_type) = doc.doc_content_type() else {
2434
doc.report().missing_field(
@@ -38,16 +48,6 @@ impl ContentTypeRule {
3848
return Ok(false);
3949
}
4050
}
41-
if let Self::NotSpecified = &self {
42-
if let Ok(content_type) = doc.doc_meta().content_type() {
43-
doc.report().unknown_field(
44-
"content-type",
45-
&content_type.to_string().as_str(),
46-
&format!("document does not expect to have the content type field"),
47-
);
48-
return Ok(false);
49-
}
50-
}
5151
let Ok(content) = doc.decoded_content() else {
5252
doc.report().functional_validation(
5353
"Invalid Document content, cannot get decoded bytes",

0 commit comments

Comments
 (0)