From 4d78ce76894adc846d00752e6b65561efe220355 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 14 Jul 2023 15:23:07 -0500 Subject: [PATCH] Fix store delegation for public_url --- .gitignore | 1 + src/store.rs | 12 +++++++++--- src/store/file_store.rs | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7ac2356..2973511 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /client-examples/javascript/node_modules /docker/object-storage/storage /docker/object-storage/pict-rs-garage.toml +/docker/object-storage/*.log /result /.ash_history /.direnv diff --git a/src/store.rs b/src/store.rs index feec060..6316ff8 100644 --- a/src/store.rs +++ b/src/store.rs @@ -94,9 +94,7 @@ pub(crate) trait Store: Clone + Debug { content_type: mime::Mime, ) -> Result; - fn public_url(&self, _: &Self::Identifier) -> Option { - None - } + fn public_url(&self, _: &Self::Identifier) -> Option; async fn to_stream( &self, @@ -160,6 +158,10 @@ where T::save_bytes(self, bytes, content_type).await } + fn public_url(&self, identifier: &Self::Identifier) -> Option { + T::public_url(self, identifier) + } + async fn to_stream( &self, identifier: &Self::Identifier, @@ -231,6 +233,10 @@ where T::save_bytes(self, bytes, content_type).await } + fn public_url(&self, identifier: &Self::Identifier) -> Option { + T::public_url(self, identifier) + } + async fn to_stream( &self, identifier: &Self::Identifier, diff --git a/src/store/file_store.rs b/src/store/file_store.rs index 7b40a00..67a3578 100644 --- a/src/store/file_store.rs +++ b/src/store/file_store.rs @@ -109,6 +109,10 @@ impl Store for FileStore { Ok(self.file_id_from_path(path)?) } + fn public_url(&self, _identifier: &Self::Identifier) -> Option { + None + } + #[tracing::instrument] async fn to_stream( &self,