Skip to content

Conversation

superboum
Copy link
Contributor

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 script

As 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 the placeholder.txt file creation.

@ghost ghost changed the base branch from main to staging August 30, 2023 08:32
@ghost ghost requested a review from yflory August 30, 2023 08:32
@ghost ghost assigned yflory Oct 10, 2023
@ghost ghost removed the request for review from yflory October 10, 2023 09:04
@mathilde-cryptpad
Copy link
Contributor

@yflory do you think we need this? I understand it could be an improvement for instance administrators but I'm not sure if the proposed changes are alright code-wise.

@yflory yflory merged commit f98ac59 into cryptpad:staging Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants