Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The bug
Currently,
Fs.writeFile(fullPath, 'PLACEHOLDER\n', w());
always fails silently.It fails silently because the error is not checked on
Fs.writeFile
.And it fails because the block folder is not created before we try to write the file.
Behaviour on the
/checkup
scriptAs a consequence, the first time you launch the server, the
placeholder.txt
file is not created.When you run the checkup script, it fails to find the file but creates the missing folder as, as soon you ask to store a proper block, because the called logic has the
Fse.mkdirp
logic, and thus the folder is created. So, on the next restart of Cryptpad, the placeholder.txt file can be created, and magically, the checkup script succeed.My patch
I create the block folder and check for error before trying to create
placeholder.txt
, then I also check for error during theplaceholder.txt
file creation.