From 253658ece59f7677554f9a8d544336afc6904616 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 4 Dec 2015 22:31:09 +0100 Subject: [PATCH] Fix: FileID::from() should also succeed if we pass a ID as string --- src/storage/file_id.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/storage/file_id.rs b/src/storage/file_id.rs index f05eaa4e..c582aa8e 100644 --- a/src/storage/file_id.rs +++ b/src/storage/file_id.rs @@ -127,7 +127,7 @@ impl From for FileID { impl<'a> From<&'a String> for FileID { fn from(string: &'a String) -> FileID { - + // we assume that it is an path let regex = Regex::new(r"([:alnum:]*)-([:upper:]*)-([A-Za-z0-9-_]*)\.(.*)").unwrap(); let s = string.split("/").last().unwrap_or(""); @@ -160,9 +160,10 @@ impl<'a> From<&'a String> for FileID { Some(FileID::new(idtype, String::from(hash))) }).unwrap_or({ debug!("Did not match"); + debug!("It is no path, actually. So we assume it is an ID already"); FileID { id_type: FileIDType::NONE, - id: None, + id: Some(string.clone()), } }) }