diff --git a/src/inscription.rs b/src/inscription.rs index b517ba0d55..e40603aaf2 100644 --- a/src/inscription.rs +++ b/src/inscription.rs @@ -316,14 +316,6 @@ impl Inscription { return true; }; - if content_type.starts_with("application/json") { - return true; - } - - if content_type.starts_with("text/plain") { - return true; - } - if content_type.starts_with("text/html") && self .body() @@ -334,6 +326,14 @@ impl Inscription { return true; } + if self.metaprotocol.is_some() { + return true; + } + + if let Media::Code(_) | Media::Text | Media::Unknown = self.media() { + return true; + } + false } } @@ -800,7 +800,7 @@ mod tests { } case(None, None, true); - case(Some("foo"), None, false); + case(Some("foo"), Some(""), true); case(Some("text/plain"), None, true); case( Some("text/plain"), @@ -820,6 +820,7 @@ mod tests { Some("/content/09a8d837ec0bcaec668ecf405e696a16bee5990863659c224ff888fb6f8f45e7i0"), true, ); + case(Some("application/yaml"), Some(""), true); case( Some("text/html;charset=utf-8"), Some("/content/09a8d837ec0bcaec668ecf405e696a16bee5990863659c224ff888fb6f8f45e7i0"), @@ -837,5 +838,13 @@ mod tests { ..Default::default() } .hidden()); + + assert!(Inscription { + content_type: Some("text/html".as_bytes().into()), + body: Some("hello".as_bytes().into()), + metaprotocol: Some(Vec::new()), + ..Default::default() + } + .hidden()); } } diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index e2701da189..42a31566ac 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -2953,7 +2953,7 @@ mod tests { for i in 0..101 { let txid = server.bitcoin_rpc_server.broadcast_tx(TransactionTemplate { - inputs: &[(i + 1, 0, 0, inscription("foo", "hello").to_witness())], + inputs: &[(i + 1, 0, 0, inscription("image/png", "hello").to_witness())], ..Default::default() }); ids.push(InscriptionId { txid, index: 0 });