Fix obfuscated unique ID handling

This commit is contained in:
Zoe Roux 2023-09-18 00:07:14 +02:00
parent 3a9941f69f
commit 8d4da63855
No known key found for this signature in database

View File

@ -150,7 +150,13 @@ pub async fn identify(path: String) -> Option<MediaInfo> {
let sha = general["UniqueID"]
.as_str()
.map(|x| x.to_string())
.and_then(|x| {
// Remove dummy values that some tools use.
if x.len() < 5 {
return None;
}
Some(x.to_string())
})
.unwrap_or_else(|| {
let mut hasher = DefaultHasher::new();
path.hash(&mut hasher);