Skip to content

Commit

Permalink
change mime library: tree_magic_mini -> file-format
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedberg committed Sep 17, 2024
1 parent 48b6564 commit 8ca8351
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
32 changes: 4 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description = "RGB tests"

[dependencies]
bitcoin_hashes = "0.14.0"
file-format = { version = "0.25.0", features = ["reader"] }
once_cell = "1.19.0"
rand = "0.8.5"
rstest = "0.19.0"
Expand All @@ -23,7 +24,6 @@ serde_yaml = "0.9"
strum = { version = "0.26.2", features = ["derive"] }
strum_macros = "0.26.2"
time = "0.3.34"
tree_magic_mini = "3.1.5"

# RGB-related deps
## bp-core
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,9 @@ pub fn attachment_from_fpath(fpath: &str) -> Attachment {
let file_bytes = std::fs::read(fpath).unwrap();
let file_hash: sha256::Hash = Hash::hash(&file_bytes[..]);
let digest = file_hash.to_byte_array().into();
let mime = tree_magic_mini::from_filepath(fpath.as_ref())
let mime = FileFormat::from_file(fpath)
.unwrap()
.media_type()
.to_string();
let media_ty: &'static str = Box::leak(mime.clone().into_boxed_str());
let media_type = MediaType::with(media_ty);
Expand Down
1 change: 1 addition & 0 deletions tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub use bpwallet::{
};
pub use descriptors::Wpkh;
pub use electrum::{Client as ElectrumClient, ElectrumApi, Param};
pub use file_format::FileFormat;
pub use ifaces::{
rgb20, rgb21,
rgb21::{EmbeddedMedia, TokenData},
Expand Down

0 comments on commit 8ca8351

Please sign in to comment.