ignore files that were probably never created

File data is inserted into the database before being created on disk,
which means that it's possible for data to exist in the database that
doesn't exist on disk. In this case, the media deletion functions should
simply ignore this error.
This commit is contained in:
Charles Hall 2024-09-17 20:58:30 -07:00
parent ca6bc74074
commit d848e787d3
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -135,6 +135,10 @@ impl Service {
Ok(()) => (),
// The file in the fs may already have been deleted by hand
Err(e) if e.kind() == std::io::ErrorKind::NotFound => (),
// The file may have never existed in the fs because the name was
// too long
#[cfg(unix)]
Err(e) if e.raw_os_error() == Some(nix::libc::ENAMETOOLONG) => (),
other_error => other_error?,
}
self.db.delete_file_metadata(key)?;