diff --git a/Cargo.lock b/Cargo.lock index ad95de9..350f4ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,6 +234,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.9.1" @@ -665,6 +671,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + [[package]] name = "errno" version = "0.3.13" @@ -675,6 +692,16 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fallible-iterator" version = "0.3.0" @@ -1147,7 +1174,7 @@ version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" dependencies = [ - "bitflags", + "bitflags 2.9.1", "cfg-if", "libc", ] @@ -1220,6 +1247,7 @@ dependencies = [ "local-ip-address", "log", "lz4_flex", + "magic", "nix", "once_cell", "prettytable-rs", @@ -1271,7 +1299,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ - "bitflags", + "bitflags 2.9.1", "libc", ] @@ -1357,6 +1385,29 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "magic" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87142e3acb1f4daa62eaea96605421a534119d4777a9fb43fb2784798fd89665" +dependencies = [ + "bitflags 1.3.2", + "errno 0.2.8", + "libc", + "magic-sys", + "thiserror 1.0.69", +] + +[[package]] +name = "magic-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff86ae08895140d628119d407d568f3b657145ee8c265878064f717534bb3bc" +dependencies = [ + "libc", + "vcpkg", +] + [[package]] name = "matchit" version = "0.8.4" @@ -1453,7 +1504,7 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ - "bitflags", + "bitflags 2.9.1", "cfg-if", "cfg_aliases", "libc", @@ -1725,7 +1776,7 @@ version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ - "bitflags", + "bitflags 2.9.1", ] [[package]] @@ -1786,7 +1837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64 0.21.7", - "bitflags", + "bitflags 2.9.1", "serde", "serde_derive", ] @@ -1797,7 +1848,7 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" dependencies = [ - "bitflags", + "bitflags 2.9.1", "chrono", "fallible-iterator", "fallible-streaming-iterator", @@ -1872,8 +1923,8 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ - "bitflags", - "errno", + "bitflags 2.9.1", + "errno 0.3.13", "libc", "linux-raw-sys", "windows-sys 0.60.2", @@ -2370,7 +2421,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bytes", "futures-core", "futures-util", @@ -2924,7 +2975,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags", + "bitflags 2.9.1", ] [[package]] diff --git a/src/modes/server/api/item.rs b/src/modes/server/api/item.rs index c6a3933..f9af591 100644 --- a/src/modes/server/api/item.rs +++ b/src/modes/server/api/item.rs @@ -505,7 +505,7 @@ async fn get_item_raw_content(item: &db::Item, data_dir: &PathBuf, conn: &mut ru let mime_type = meta_entries .iter() - .find(|m| m.name == "file.mime") + .find(|m| m.name == "mime_type") .map(|m| m.value.clone()) .unwrap_or_else(|| "application/octet-stream".to_string()); diff --git a/src/modes/server/common.rs b/src/modes/server/common.rs index f22a804..3a32d21 100644 --- a/src/modes/server/common.rs +++ b/src/modes/server/common.rs @@ -89,7 +89,7 @@ pub struct ItemInfo { pub compression: String, #[schema(example = json!(["important", "work", "document"]))] pub tags: Vec, - #[schema(example = json!({"file.mime": "text/plain", "file.encoding": "utf-8", "line_count": "42"}))] + #[schema(example = json!({"mime_type": "text/plain", "mime_encoding": "utf-8", "line_count": "42"}))] pub metadata: HashMap, } @@ -97,7 +97,7 @@ pub struct ItemInfo { #[schema(description = "Item information including content and metadata, with binary detection")] pub struct ItemContentInfo { #[serde(flatten)] - #[schema(example = json!({"file.mime": "text/plain", "file.encoding": "utf-8", "line_count": "42"}))] + #[schema(example = json!({"mime_type": "text/plain", "mime_encoding": "utf-8", "line_count": "42"}))] pub metadata: HashMap, #[schema(example = "Hello, world!\nThis is the content of the file.")] pub content: Option,