diff options
-rw-r--r-- | tvix/store/src/blobservice/from_addr.rs | 5 | ||||
-rw-r--r-- | tvix/store/src/blobservice/sled.rs | 12 |
2 files changed, 7 insertions, 10 deletions
diff --git a/tvix/store/src/blobservice/from_addr.rs b/tvix/store/src/blobservice/from_addr.rs index 914e590033bb..bef1a45a1c3c 100644 --- a/tvix/store/src/blobservice/from_addr.rs +++ b/tvix/store/src/blobservice/from_addr.rs @@ -12,9 +12,8 @@ use super::{BlobService, GRPCBlobService, MemoryBlobService, SledBlobService}; /// /// See their [from_url] methods for more details about their syntax. pub fn from_addr(uri: &str) -> Result<Arc<dyn BlobService>, crate::Error> { - let url = Url::parse(uri).map_err(|e| { - crate::Error::StorageError(format!("unable to parse url: {}", e.to_string())) - })?; + let url = Url::parse(uri) + .map_err(|e| crate::Error::StorageError(format!("unable to parse url: {}", e)))?; Ok(if url.scheme() == "memory" { Arc::new(MemoryBlobService::from_url(&url)?) diff --git a/tvix/store/src/blobservice/sled.rs b/tvix/store/src/blobservice/sled.rs index 6b38a5e0ed81..2b8f9e7bbb13 100644 --- a/tvix/store/src/blobservice/sled.rs +++ b/tvix/store/src/blobservice/sled.rs @@ -47,14 +47,12 @@ impl BlobService for SledBlobService { // TODO: expose compression and other parameters as URL parameters, drop new and new_temporary? if url.path().is_empty() { Self::new_temporary().map_err(|e| Error::StorageError(e.to_string())) + } else if url.path() == "/" { + Err(crate::Error::StorageError( + "cowardly refusing to open / with sled".to_string(), + )) } else { - if url.path() == "/" { - Err(crate::Error::StorageError( - "cowardly refusing to open / with sled".to_string(), - )) - } else { - Self::new(url.path().into()).map_err(|e| Error::StorageError(e.to_string())) - } + Self::new(url.path().into()).map_err(|e| Error::StorageError(e.to_string())) } } |