From b9b8ced689fbf3f3f5df332c49714ede7f9d393b Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Thu, 31 Aug 2023 08:23:10 +0100 Subject: [PATCH] [scan] Handles case for file overwrite/move within library that previously original db entry for overwritten file Fixes #1645 --- src/library/filescanner.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/library/filescanner.c b/src/library/filescanner.c index 0b16d110..1e2ba658 100644 --- a/src/library/filescanner.c +++ b/src/library/filescanner.c @@ -1323,6 +1323,12 @@ process_inotify_file(struct watch_info *wi, char *path, struct inotify_event *ie { DPRINTF(E_DBG, L_SCAN, "File moved to: %s\n", path); + /* handle overwriting an existing file, no inotify event generated for the + * overwrite on existing file before we update the path of moved file + */ + db_file_delete_bypath(path); + cache_artwork_delete_by_path(path); + ret = db_file_enable_bycookie(ie->cookie, path, filename_from_path(path)); if (ret > 0)