Fix: use Path::file_stem() instead of Path::file_name()

Because we don't want to know the extension of the filename here.
This commit is contained in:
Matthias Beyer 2018-03-12 13:30:30 +01:00
parent d3b38b5a90
commit 8a9b2e9a8f

View file

@ -51,7 +51,7 @@ impl UniqueRefPathGenerator for UniqueContactPathGenerator {
fn unique_hash<A: AsRef<Path>>(path: A) -> RResult<String, Self::Error> { fn unique_hash<A: AsRef<Path>>(path: A) -> RResult<String, Self::Error> {
debug!("Generating unique hash for path: {:?}", path.as_ref()); debug!("Generating unique hash for path: {:?}", path.as_ref());
if let Some(p) = path.as_ref().file_name().and_then(OsStr::to_str).map(String::from) { if let Some(p) = path.as_ref().file_stem().and_then(OsStr::to_str).map(String::from) {
debug!("Found UUID string: '{}'", p); debug!("Found UUID string: '{}'", p);
Uuid::parse_str(&p) Uuid::parse_str(&p)
.map_err(CE::from) .map_err(CE::from)