[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

upload: guess mime type from extension via mime_guess crate

i am absolving myself of all mime type issues with the upload function

ppl can pr OR manually edit mime types on pdsls OR just use normal file extensions

vielle.dev edc717c4 f5f3239a

verified
Changed files
+29 -1
upload
+23
upload/Cargo.lock
··· 67 67 dependencies = [ 68 68 "clap", 69 69 "ignore", 70 + "mime_guess", 70 71 "regex", 71 72 ] 72 73 ··· 205 206 checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" 206 207 207 208 [[package]] 209 + name = "mime" 210 + version = "0.3.17" 211 + source = "registry+https://github.com/rust-lang/crates.io-index" 212 + checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 213 + 214 + [[package]] 215 + name = "mime_guess" 216 + version = "2.0.5" 217 + source = "registry+https://github.com/rust-lang/crates.io-index" 218 + checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" 219 + dependencies = [ 220 + "mime", 221 + "unicase", 222 + ] 223 + 224 + [[package]] 208 225 name = "once_cell_polyfill" 209 226 version = "1.70.1" 210 227 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 311 328 "quote", 312 329 "unicode-ident", 313 330 ] 331 + 332 + [[package]] 333 + name = "unicase" 334 + version = "2.8.1" 335 + source = "registry+https://github.com/rust-lang/crates.io-index" 336 + checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" 314 337 315 338 [[package]] 316 339 name = "unicode-ident"
+1
upload/Cargo.toml
··· 7 7 clap = { version = "4.5.49", features = ["derive"] } 8 8 ignore = "0.4.23" 9 9 regex = "1.12.2" 10 + mime_guess = "2.0.5"
+5 -1
upload/src/sitemap.rs
··· 79 79 let key = x.path().to_str()?; 80 80 let key = String::from(key); 81 81 82 + let mime = mime_guess::from_path(&key); 83 + let mime = mime.first()?; 84 + let mime = mime.essence_str(); 85 + 82 86 Some(( 83 87 key, 84 88 SitemapNode { 85 - mime_type: String::from("application/octet-stream"), 89 + mime_type: String::from(mime), 86 90 blob: BlobRef::Local(x.path().to_owned()), 87 91 }, 88 92 ))