Fix FileStream.file_name() (#4875)
This commit is contained in:
1 parent
2117c3d4e9
commit
41f68582e9
1 file changed
+3
-6
@@ -212,12 +212,9 @@ impl<S> FromRequest<S> for FileStream {
|
|||||||
let filename = match disposition.map(|s| s.to_str()) {
|
let filename = match disposition.map(|s| s.to_str()) {
|
||||||
Some(Ok(dis)) => {
|
Some(Ok(dis)) => {
|
||||||
let content = content_disposition::parse_content_disposition(dis);
|
let content = content_disposition::parse_content_disposition(dis);
|
||||||
let names = content.filename();
|
content
|
||||||
match names {
|
.filename_full()
|
||||||
Some((_name, Some(filename))) => filename.to_string(),
|
.unwrap_or_else(|| "file".to_string())
|
||||||
Some((name, None)) => name.to_string(),
|
|
||||||
None => "file".to_string(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => "file".to_string(),
|
_ => "file".to_string(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user