diff --git a/CHANGELOG.md b/CHANGELOG.md index 331b408f..7c05c6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## v0.30.1 (WIP) +- ⚠️ Excluded the `lost+found` directory from the backups ([#7208](https://github.com/pocketbase/pocketbase/pull/7208); thanks @lbndev). + _If for some reason you want to keep it, you can restore it by editing the `e.Exclude` list of the `OnBackupCreate` and `OnBackupRestore` hooks._ + - Updated Go dependencies. diff --git a/core/base.go b/core/base.go index 0f9252d9..01185196 100644 --- a/core/base.go +++ b/core/base.go @@ -40,6 +40,9 @@ const ( LocalBackupsDirName string = "backups" LocalTempDirName string = ".pb_temp_to_delete" // temp pb_data sub directory that will be deleted on each app.Bootstrap() LocalAutocertCacheDirName string = ".autocert_cache" + + // @todo consider removing after backups refactoring + lostFoundDirName string = "lost+found" ) // FilesManager defines an interface with common methods that files manager models should implement. diff --git a/core/base_backup.go b/core/base_backup.go index ff08e693..b0b2f2d5 100644 --- a/core/base_backup.go +++ b/core/base_backup.go @@ -54,7 +54,7 @@ func (app *BaseApp) CreateBackup(ctx context.Context, name string) error { event.Context = ctx event.Name = name // default root dir entries to exclude from the backup generation - event.Exclude = []string{LocalBackupsDirName, LocalTempDirName, LocalAutocertCacheDirName} + event.Exclude = []string{LocalBackupsDirName, LocalTempDirName, LocalAutocertCacheDirName, lostFoundDirName} return app.OnBackupCreate().Trigger(event, func(e *BackupEvent) error { // generate a default name if missing @@ -159,7 +159,7 @@ func (app *BaseApp) RestoreBackup(ctx context.Context, name string) error { event.Context = ctx event.Name = name // default root dir entries to exclude from the backup restore - event.Exclude = []string{LocalBackupsDirName, LocalTempDirName, LocalAutocertCacheDirName} + event.Exclude = []string{LocalBackupsDirName, LocalTempDirName, LocalAutocertCacheDirName, lostFoundDirName} return app.OnBackupRestore().Trigger(event, func(e *BackupEvent) error { if runtime.GOOS == "windows" { diff --git a/tests/data/lost+found/test.txt b/tests/data/lost+found/test.txt new file mode 100644 index 00000000..9daeafb9 --- /dev/null +++ b/tests/data/lost+found/test.txt @@ -0,0 +1 @@ +test