LiteDB can open non-database files as if they were database files. When the content of a text file is just "Invalid content," LiteDB will open it as a normal database file and write data to it. However, if the "Invalid content" is repeated many times, making the file size reach 16K, LiteDB will throw an unhandled exception when writing data.
Steps to Reproduce
Create a text file with the content "Invalid content."
Attempt to open the file with LiteDB and write data to it. Notice that LiteDB treats it as a valid database file.
Modify the text file by repeating "Invalid content" until the file size reaches 16K.
Attempt to write data to the file using LiteDB. An unhandled exception will be thrown.
Expected Behavior
LiteDB should not treat non-database files as valid database files. It should properly validate the file content and structure before opening and writing data. If the file content is invalid, LiteDB should throw an appropriate exception indicating the issue.
Description
LiteDB can open non-database files as if they were database files. When the content of a text file is just "Invalid content," LiteDB will open it as a normal database file and write data to it. However, if the "Invalid content" is repeated many times, making the file size reach 16K, LiteDB will throw an unhandled exception when writing data.
Steps to Reproduce
Expected Behavior
LiteDB should not treat non-database files as valid database files. It should properly validate the file content and structure before opening and writing data. If the file content is invalid, LiteDB should throw an appropriate exception indicating the issue.
Environment