improve file streams

This commit is contained in:
2025-09-06 18:00:58 +02:00
parent 1c4aaa7040
commit 5c09120c23
4 changed files with 55 additions and 14 deletions

View File

@@ -265,7 +265,11 @@ impl FileSystem {
}
});
FileStream::new(FileType::Directory, ReceiverStream::new(rx))
FileStream::new(
FileType::Directory,
Some(FileMimeType::new_raw("application/zip")),
ReceiverStream::new(rx),
)
}
match path_request {
@@ -293,7 +297,20 @@ impl FileSystem {
bail!("File size exceeds configured limit");
}
let stream = FileStream::new(FileType::File, ReaderStream::new(file));
let mime_type = {
let file_name = {
let path = file_path.as_str();
if let Some(last_slash_index) = path.rfind("/") {
&path[last_slash_index + 1..]
} else {
path
}
};
FileMimeType::from_name(file_name)
};
let stream = FileStream::new(FileType::File, mime_type, ReaderStream::new(file));
Ok(stream)
}