From 0f73a60cc0d48a14c3cd1e0c2c756e9f0b6b8554 Mon Sep 17 00:00:00 2001 From: Matthew Pomes Date: Sat, 27 Dec 2025 22:53:19 -0600 Subject: [PATCH] Handle missing `reuse` parameter correctly Actually check for missing key, since figment doesn't properly decode `Option` on it's own. closes: #2976 --- core/lib/src/listener/unix.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/lib/src/listener/unix.rs b/core/lib/src/listener/unix.rs index 37a22b9dd..dfbd27b24 100644 --- a/core/lib/src/listener/unix.rs +++ b/core/lib/src/listener/unix.rs @@ -2,6 +2,7 @@ use std::io; use std::path::{Path, PathBuf}; use either::{Either, Left, Right}; +use figment::error::Kind; use tokio::time::{sleep, Duration}; use crate::fs::NamedFile; @@ -79,8 +80,11 @@ impl Bind for UnixListener { let path = endpoint.unix() .ok_or_else(|| Right(io::Error::other("internal error: invalid endpoint")))?; - let reuse: Option = rocket.figment().extract_inner("reuse").map_err(Left)?; - Ok(Self::bind(path, reuse.unwrap_or(true)).await.map_err(Right)?) + let reuse: bool = rocket.figment() + .extract_inner("reuse") + .or_else(|e| if e.missing() { Ok(true) } else { Err(e) } ) + .map_err(Left)?; + Ok(Self::bind(path, reuse).await.map_err(Right)?) } fn bind_endpoint(rocket: &Rocket) -> Result {