Fixed image name parser

This commit is contained in:
strNophix 2022-06-25 21:03:32 +02:00
parent c44452648d
commit f71dff4e3d

View File

@ -79,14 +79,14 @@ pub struct ImageIdentifier {
impl ImageIdentifier {
pub fn from_string(image: &String) -> Self {
let mut iter = image.rsplitn(2, ':');
let tag = iter.next().unwrap_or("latest").to_string();
let mut iter = image.splitn(2, ':');
let mut loc_iter = iter.next().unwrap().split('/').rev();
let name = loc_iter
.next()
.expect("No image name was supplied")
.to_string();
let author = loc_iter.next().unwrap_or("library").to_string();
let tag = iter.next().unwrap_or("latest").to_string();
return ImageIdentifier { author, name, tag };
}
}