add backup panel
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m47s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m52s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Rust / build (macos-latest, stable) (pull_request) Has been cancelled
Rust / build (windows-latest, stable) (pull_request) Has been cancelled
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m47s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m52s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Rust / build (macos-latest, stable) (pull_request) Has been cancelled
Rust / build (windows-latest, stable) (pull_request) Has been cancelled
This commit is contained in:
@@ -25,61 +25,3 @@ pub async fn upload(server: Url, path: PathBuf, cx: &AsyncApp) -> Result<Url, Er
|
||||
.await
|
||||
.map_err(|e| anyhow!("Upload error: {e}"))?
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_mime_type_detection() {
|
||||
// Test common file extensions
|
||||
assert_eq!(
|
||||
from_path("image.jpg").first_or_octet_stream().to_string(),
|
||||
"image/jpeg"
|
||||
);
|
||||
assert_eq!(
|
||||
from_path("document.pdf")
|
||||
.first_or_octet_stream()
|
||||
.to_string(),
|
||||
"application/pdf"
|
||||
);
|
||||
assert_eq!(
|
||||
from_path("page.html").first_or_octet_stream().to_string(),
|
||||
"text/html"
|
||||
);
|
||||
assert_eq!(
|
||||
from_path("data.json").first_or_octet_stream().to_string(),
|
||||
"application/json"
|
||||
);
|
||||
assert_eq!(
|
||||
from_path("script.js").first_or_octet_stream().to_string(),
|
||||
"text/javascript"
|
||||
);
|
||||
assert_eq!(
|
||||
from_path("style.css").first_or_octet_stream().to_string(),
|
||||
"text/css"
|
||||
);
|
||||
|
||||
// Test unknown extension falls back to octet-stream
|
||||
assert_eq!(
|
||||
from_path("unknown.xyz").first_or_octet_stream().to_string(),
|
||||
"chemical/x-xyz"
|
||||
);
|
||||
|
||||
// Test no extension falls back to octet-stream
|
||||
assert_eq!(
|
||||
from_path("file_without_extension")
|
||||
.first_or_octet_stream()
|
||||
.to_string(),
|
||||
"application/octet-stream"
|
||||
);
|
||||
|
||||
// Test truly unknown extension
|
||||
assert_eq!(
|
||||
from_path("unknown.unknown123")
|
||||
.first_or_octet_stream()
|
||||
.to_string(),
|
||||
"application/octet-stream"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user