Nextcloud crashes if the Collectives folder is a group folder

I just wanted to report a bug with Collectives. I have attempted to make the folder « Collectives » a public folder. The intent is to allow anyone edit the documents with the usual text editor if need be. This lead NC to crash.

Steps to reproduce the bug:

  1. Start with a non-empty collective set of pages, created with the standard collectives edition process.
  2. Create a group folder called « Collectives - 2 » .
  3. Migrate all content from the « Collectives » folder to « Collectives -2 ».
  4. Rename « Collectives » to « Collectives - old»
  5. Rename « Collectives -2 » to « Collectives »

I am pretty sure the crash happens because of step 4. For sure, the following things happen after step 5:

  1. The collectives app attempts to re-create a « Collectives » folder, as it does not recognize the group folder.
  2. Because there is already a group folder with that name, it creates a folder named « Collectives (1) ».
  3. As it does not recognize the « Collectives (n) » folder, it repeats steps 1 and 2 indefinitely, creating a folder « Collectives (n+1) » in the process.
  4. At some point, the server crashes because it cannot handle so much folders.

How to fix it:
Here are some suggestions:

  1. Allow the Collective app to work with/recognize group folders.
  2. Allow for folders « Collective (n) » to be acceptable substitutes for the original « Collectives ».
  3. Create protected keywords in the group folder creation process. E.g. a group folders called « Collectives » could not be created. This provides a patch, but does not fix the bug of folder creation.
  4. Add a state variable to the folder creation process, so that after n attempts, it stops and reports a bug.

How to fix the server crash in the meantime:
If that ever occurs to anyone, here are the steps to recover your nextcloud instance:

  1. With OCC, go in maintenance mode.
  2. With OCC, disable the « collectives app ».
  3. Delete all folders called « Collectives (n) ».
  4. Do steps 5 to 2 of the section « How to reproduce the bugs » in reverse.
  5. With OCC, quit maintenance mode.

I hope this helps.

Thanks for this promising app.