Fix: FileID::from() should also succeed if we pass a ID as string
This commit is contained in:
parent
38158e2edf
commit
253658ece5
1 changed files with 3 additions and 2 deletions
|
@ -127,7 +127,7 @@ impl From<String> 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()),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue