From d848e787d3a689bdb5cfa30f913934ac2eebd83f Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Tue, 17 Sep 2024 20:58:30 -0700 Subject: [PATCH] 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. --- src/service/media.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/service/media.rs b/src/service/media.rs index 0b4903aa..03109004 100644 --- a/src/service/media.rs +++ b/src/service/media.rs @@ -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)?;