Open ArsenMkrt opened 8 months ago
Checked the code, in method public long Rebuild(RebuildOptions options = null)
it should use settings to build RebuildOptions when null
return _engine.Rebuild(options ?? new RebuildOptions()); // password is null here if options is passed as null
Version 5.0.18, 5.0.19
Describe the bug When database is encrypted with password, database.Rebuild() call reset password to empty, than fails This behavior have been changed from version 5.0.17, until version 5.0.18 it was just rebuilding the database and keeping password if no parameter have been provided to Rebuild method.
Error:
Unhandled exception. LiteDB.LiteException: File is not encrypted.
Code to Reproduce
var connectionString = new LiteDB.ConnectionString() { Filename = "test.db", Password = "password", }; LiteDB.ILiteDatabase db = new LiteDB.LiteDatabase(connectionString); db.Rebuild();
Expected behavior db.Rebuild() should just rebuild the database, as ILiteDatabase already contains the password
Screenshots/Stacktrace
Additional context As a workaround password can be provided one more time
db.Rebuild(new LiteDB.Engine.RebuildOptions { Password = "password" });