Skip to content

fix(sync): cleanup DB before syncing files to DB to avoid FileNotFoundException

Alexander Hofbauer requested to merge fix/sync-command-file-not-found into main

Solution

The idea of the sync command is to essentially mirror what the filesystem to the DB, so the filesystem is the source of truth here, right? This also means that cleaning up the DB before updating from the filesystem should work, because the DB entries are updated anyway.

Issue

When there are Content Section Layout entries in the DB that don't exist on the filesystem anymore, a FileNotFoundException was thrown. This was due to the fact that the sync command tries to read the CSLs' "index" file but could not find it. Removing the DB entry first based on what is on the filesystem solves this issue.

Disclaimer

I am not 100% sure what happens during the sync process, I did some debugging and did not find any issues with this solution, but you guys know the system way better than me 😄

Edited by Alexander Hofbauer

Merge request reports