Skip to content

Commit

Permalink
fix: store inscription content as is (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr authored Jan 29, 2025
1 parent 2dba824 commit 3f10607
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions components/ordhook-core/src/db/models/db_inscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ impl DbInscription {
tx_index: usize,
timestamp: u32,
) -> Self {
// Remove null bytes from `content` and `content_type`
let mut content = hex::decode(&reveal.content_bytes[2..]).unwrap();
content.retain(|&x| x != 0);
// Remove null bytes from `content_type`
let mut content_type_bytes = reveal.content_type.clone().into_bytes();
content_type_bytes.retain(|&x| x != 0);
let content_type = String::from_utf8(content_type_bytes).unwrap();
Expand All @@ -62,7 +60,7 @@ impl DbInscription {
mime_type: content_type.split(';').nth(0).unwrap().to_string(),
content_type,
content_length: PgBigIntU32(reveal.content_length as u32),
content,
content: hex::decode(&reveal.content_bytes[2..]).unwrap(),
fee: PgNumericU64(reveal.inscription_fee),
curse_type: reveal.curse_type.as_ref().map(|c| match c {
OrdinalInscriptionCurseType::DuplicateField => "duplicate_field".to_string(),
Expand Down

0 comments on commit 3f10607

Please sign in to comment.