max strip len config option
This commit is contained in:
parent
7bfbe3b1fe
commit
2e92ab4bf0
|
@ -37,6 +37,10 @@ pub struct EngineConfig {
|
|||
#[serde_as(as = "DurationSeconds")]
|
||||
pub max_temp_lifetime: Duration,
|
||||
|
||||
/// Maximum length (in bytes) a file can be before the server will
|
||||
/// decide not to remove its EXIF data.
|
||||
pub max_strip_len: usize,
|
||||
|
||||
/// Motd displayed when the server's index page is visited.
|
||||
///
|
||||
/// This isn't explicitly engine-related but the engine is what gets passed to routes,
|
||||
|
@ -73,6 +77,7 @@ pub struct CacheConfig {
|
|||
|
||||
#[derive(Deserialize)]
|
||||
pub struct HttpConfig {
|
||||
/// The IP address the HTTP server should listen on
|
||||
pub listen_on: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ impl Engine {
|
|||
}
|
||||
|
||||
/// Fetch an upload
|
||||
///
|
||||
///
|
||||
/// This will first try to read from cache, and then disk after.
|
||||
/// If an upload is eligible to be cached, it will be cached and
|
||||
/// sent back as a cache response instead of a disk response.
|
||||
|
@ -160,7 +160,7 @@ impl Engine {
|
|||
}
|
||||
|
||||
/// Save a file to disk, and optionally cache.
|
||||
///
|
||||
///
|
||||
/// This also handles custom file lifetimes and EXIF data removal.
|
||||
pub async fn save(
|
||||
&self,
|
||||
|
@ -196,7 +196,7 @@ impl Engine {
|
|||
Some(Some("png" | "jpg" | "jpeg" | "webp" | "tiff"))
|
||||
)
|
||||
&& !keep_exif
|
||||
&& provided_len <= 16_777_216;
|
||||
&& provided_len <= self.cfg.max_strip_len;
|
||||
|
||||
// read and save upload
|
||||
while let Some(chunk) = stream.next().await {
|
||||
|
|
Loading…
Reference in New Issue