improve file streams
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user