From fd3d2ec8dc8a502ca7f3bd7a8aef424636a56ad7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 4 Dec 2015 22:57:28 +0100 Subject: [PATCH] Fixup get_file_by_id() --- src/storage/backend.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index bf209461..508dac9e 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -192,6 +192,7 @@ impl StorageBackend { if id.get_type() == FileIDType::NONE { // We don't know the hash type, so we glob() around a bit. + debug!("Having FileIDType::NONE, so we glob() for the raw ID"); let globstr = self.prefix_of_files_for_module(m) + "*" + ".imag"; glob(&globstr[..]).map(|globlist| { @@ -200,10 +201,14 @@ impl StorageBackend { .collect::>(); vec.reverse(); vec.pop() - }).map_err(|e| e).unwrap() + }).unwrap_or({ + debug!("No glob matches, actually. We can't do anything at this point"); + None + }) } else { // The (hash)type is already in the FileID object, so we can just // build a path from the information we already have + debug!("We know FileIDType, so we build the path directly now"); if let Ok(mut fs) = FSFile::open(self.build_filepath_with_id(m, id.clone())) { let mut s = String::new(); fs.read_to_string(&mut s);