about summary refs log tree commit diff
path: root/kittybox-rs/src/media
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs/src/media')
-rw-r--r--kittybox-rs/src/media/storage/file.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/kittybox-rs/src/media/storage/file.rs b/kittybox-rs/src/media/storage/file.rs
index 59723d5..0aaaa3b 100644
--- a/kittybox-rs/src/media/storage/file.rs
+++ b/kittybox-rs/src/media/storage/file.rs
@@ -141,7 +141,8 @@ impl MediaStore for FileStore {
         domain: &str,
         filename: &str,
     ) -> Result<(Metadata, Pin<Box<dyn tokio_stream::Stream<Item = std::io::Result<bytes::Bytes>> + Send>>)> {
-        let path = self.base.join(format!("{}/{}", domain, filename));
+        debug!("Domain: {}, filename: {}", domain, filename);
+        let path = self.base.join(domain).join(filename);
         debug!("Path: {}", path.display());
 
         let file = OpenOptions::new()
@@ -165,7 +166,7 @@ impl MediaStore for FileStore {
 
     #[tracing::instrument(skip(self))]
     async fn metadata(&self, domain: &str, filename: &str) -> Result<Metadata> {
-        let metapath = self.base.join(format!("{}{}.json", domain, filename));
+        let metapath = self.base.join(domain).join(format!("{}.json", filename));
         debug!("Metadata path: {}", metapath.display());
 
         let meta = serde_json::from_slice(&tokio::fs::read(metapath).await?)
@@ -291,7 +292,7 @@ mod tests {
         // try to read range
         let range = {
             let stream = store.stream_range(
-                "fireburn.ru", &("/".to_string() + &filename),
+                "fireburn.ru", &filename,
                 (Bound::Included(0), Bound::Included(299))
             ).await.unwrap();
 
@@ -310,7 +311,7 @@ mod tests {
 
         let range = {
             let stream = store.stream_range(
-                "fireburn.ru", &("/".to_string() + &filename),
+                "fireburn.ru", &filename,
                 (Bound::Included(150), Bound::Included(449))
             ).await.unwrap();
 
@@ -328,7 +329,7 @@ mod tests {
         tracing::debug!("Reading range from the end...");
         let range = {
             let stream = store.stream_range(
-                "fireburn.ru", &("/".to_string() + &filename),
+                "fireburn.ru", &filename,
                 // Note: the `headers` crate parses bounds in a
                 // non-standard way, where unbounded start actually
                 // means getting things from the end...
@@ -413,7 +414,7 @@ mod tests {
         let (metadata, read_back) = {
             let (metadata, stream) = store.read_streaming(
                 "fireburn.ru",
-                &("/".to_string() + &filename)
+                &filename
             ).await.unwrap();
             let mut reader = tokio_util::io::StreamReader::new(stream);