mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
fix: serve files with names containing newline char (#328)
This commit is contained in:
@@ -16,7 +16,14 @@ pub const BIN_FILE: &str = "😀.bin";
|
||||
|
||||
/// File names for testing purpose
|
||||
#[allow(dead_code)]
|
||||
pub static FILES: &[&str] = &["test.txt", "test.html", "index.html", BIN_FILE];
|
||||
pub static FILES: &[&str] = &[
|
||||
"test.txt",
|
||||
"test.html",
|
||||
"index.html",
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
"file\n1.txt",
|
||||
BIN_FILE,
|
||||
];
|
||||
|
||||
/// Directory names for testing directory don't exist
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -207,6 +207,18 @@ fn get_file_emoji_path(server: TestServer) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[rstest]
|
||||
fn get_file_newline_path(server: TestServer) -> Result<(), Error> {
|
||||
let resp = reqwest::blocking::get(format!("{}file%0A1.txt", server.url()))?;
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_eq!(
|
||||
resp.headers().get("content-disposition").unwrap(),
|
||||
"inline; filename=\"file 1.txt\""
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn get_file_edit(server: TestServer) -> Result<(), Error> {
|
||||
let resp = fetch!(b"GET", format!("{}index.html?edit", server.url())).send()?;
|
||||
|
||||
Reference in New Issue
Block a user