2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Fix store delegation for public_url

This commit is contained in:
asonix 2023-07-14 15:23:07 -05:00
parent 786f583d98
commit 4d78ce7689
3 changed files with 14 additions and 3 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
/client-examples/javascript/node_modules /client-examples/javascript/node_modules
/docker/object-storage/storage /docker/object-storage/storage
/docker/object-storage/pict-rs-garage.toml /docker/object-storage/pict-rs-garage.toml
/docker/object-storage/*.log
/result /result
/.ash_history /.ash_history
/.direnv /.direnv

View file

@ -94,9 +94,7 @@ pub(crate) trait Store: Clone + Debug {
content_type: mime::Mime, content_type: mime::Mime,
) -> Result<Self::Identifier, StoreError>; ) -> Result<Self::Identifier, StoreError>;
fn public_url(&self, _: &Self::Identifier) -> Option<url::Url> { fn public_url(&self, _: &Self::Identifier) -> Option<url::Url>;
None
}
async fn to_stream( async fn to_stream(
&self, &self,
@ -160,6 +158,10 @@ where
T::save_bytes(self, bytes, content_type).await T::save_bytes(self, bytes, content_type).await
} }
fn public_url(&self, identifier: &Self::Identifier) -> Option<url::Url> {
T::public_url(self, identifier)
}
async fn to_stream( async fn to_stream(
&self, &self,
identifier: &Self::Identifier, identifier: &Self::Identifier,
@ -231,6 +233,10 @@ where
T::save_bytes(self, bytes, content_type).await T::save_bytes(self, bytes, content_type).await
} }
fn public_url(&self, identifier: &Self::Identifier) -> Option<url::Url> {
T::public_url(self, identifier)
}
async fn to_stream( async fn to_stream(
&self, &self,
identifier: &Self::Identifier, identifier: &Self::Identifier,

View file

@ -109,6 +109,10 @@ impl Store for FileStore {
Ok(self.file_id_from_path(path)?) Ok(self.file_id_from_path(path)?)
} }
fn public_url(&self, _identifier: &Self::Identifier) -> Option<url::Url> {
None
}
#[tracing::instrument] #[tracing::instrument]
async fn to_stream( async fn to_stream(
&self, &self,