about summary refs log tree commit diff
path: root/kittybox-rs/src/media/storage/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs/src/media/storage/mod.rs')
-rw-r--r--kittybox-rs/src/media/storage/mod.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/kittybox-rs/src/media/storage/mod.rs b/kittybox-rs/src/media/storage/mod.rs
index 5614437..b34da88 100644
--- a/kittybox-rs/src/media/storage/mod.rs
+++ b/kittybox-rs/src/media/storage/mod.rs
@@ -5,22 +5,24 @@ use bytes::Bytes;
 use serde::{Deserialize, Serialize};
 use std::pin::Pin;
 use std::fmt::Debug;
+use std::num::NonZeroUsize;
 
 pub mod file;
 
 #[derive(Debug, Deserialize, Serialize)]
 pub struct Metadata {
-    pub(super) content_type: String,
-    pub(super) filename: Option<String>,
-    pub(super) length: Option<usize>
+    /// Content type of the file. If None, the content-type is considered undefined.
+    pub content_type: Option<String>,
+    /// The original filename that was passed.
+    pub filename: Option<String>,
+    /// The recorded length of the file.
+    pub length: Option<NonZeroUsize>,
 }
 impl From<&Field<'_>> for Metadata {
     fn from(field: &Field<'_>) -> Self {
         Self {
             content_type: field.content_type()
-                .map(|i| i.to_owned())
-                .or_else(|| Some("application/octet-stream".to_owned()))
-                .unwrap(),
+                .map(|i| i.to_owned()),
             filename: field.file_name()
                 .map(|i| i.to_owned()),
             length: None