Skip to content

Data loss from a restored folder #1523

Closed

Description

@tammi-23

Describe the bug

It is possible to create two folders with the same name. This leads to a conflict and to strange behavior.

Steps to reproduce

  1. Create a Folder A with a File B
  2. First Delete the File B
  3. Delete Folder A
  4. Restore File B from Trashbin (here the Folder from 3. is recreated)
  5. Restore Folder A (from Trashbin) and choose "keep both"
  6. Click on the Folder with 0 kb (there is the File inside)
  7. Go back and click on both folders (they both has the file inside)
  8. Rename the empty folder (now one of both folders is not usable after the user is navigating into the folder)

Expected behavior

Both folder are usable or the 2nd folder is created with an other name and there are no conflicts

Actual behavior

Inside one of both folder it is not possible to create files (no new and no upload available)

"Resource not found
We went looking everywhere, but were unable to find the selected resource.
Go to »Personal« page" is displayed

Image

Activity

  1. v-scharf commented on Sep 19, 2025

    @v-scharf
    Contributor

    interesting, web has correct destination with prefix (1) https://host.docker.internal:9200/remote.php/dav/spaces/27e7e0f6-cd60-4ad8-9684-223e0eb7c39f%24c0f63a6e-db39-4156-979b-cbf69af40473/new%20(1)
    we need a get second folder a (1)

  2. moved this from Qualification to Prio <= 3 in OpenCloud Team Boardon Sep 22, 2025
  3. v-scharf commented on Oct 10, 2025

    @v-scharf
    Contributor

    tested on demo instance https://demo.opencloud.eu/ OpenCloud 3.5.0 OpenCloud Web UI 4.0.0

    Steps:

    • create New folder with file
    • delete New folder
    • create new empty New folder
    • restore old New folder from trash using "keep both"

    Actual: 2 New folder folders, both are empty. No way to restore file which was inside

    Expected: user has two folders: - new empty New folder and restored folder with file New folder (1)

  4. moved this from Prio <= 3 to Prio 1 in OpenCloud Team Boardon Oct 10, 2025
  5. added
    Priority:p1-urgent
    and removed
    Priority:p3-medium
    on Oct 10, 2025
  6. changed the title [-]Conflict with restored Folder[/-] [+]Data loss from a restored folder[/+] on Oct 10, 2025
  7. self-assigned this
    on Oct 13, 2025
  8. moved this from Prio 1 to In Progress in OpenCloud Team Boardon Oct 13, 2025
  9. fschade commented on Oct 13, 2025

    @fschade
    Member

    bug is posix fs related, decomposed (export STORAGE_USERS_DRIVER=decomposed) works as designed!

    posix fs has another critical error case (which is similar):

    Steps

    • Create a Folder A with a File B, and File C
    • First Delete the File B
    • Delete Folder A
    • Restore File B from Trashbin (here the Folder from 3. is recreated)
    • Restore Folder A (from Trashbin) and choose "keep both"

    Result

    FILE C is gone

  10. fschade commented on Oct 14, 2025

    @fschade
    Member

    ❓

    Steps

    • Create a Folder A with a File B
    • First Delete the File B
    • Delete Folder A
    • Restore Folder A

    Result

    Folder A is empty, File B is still in the trash-bin

    Q

    is it expected that the folder A is empty? In decomposed fs the behavior is the same!

  11. rhafer commented on Oct 14, 2025

    @rhafer
    Member

    is it expected that the folder A is empty? In decomposed fs the behavior is the same!

    Since File B was already in the trash before you trashed Folder A I think that is the expected behavior.

  12. v-scharf commented on Oct 14, 2025

    @v-scharf
    Contributor

    Steps:

    • create New folder with file
    • delete New folder
    • create new empty New folder
    • restore old New folder from trash using "keep both"

    Actual: 2 New folder folders, both are empty. No way to restore file which was inside

    Expected: user has two folders: - new empty New folder and restored folder with file New folder (1)

    I wrote a test for this case and was surprised because it passed.

    Scenario Outline: restore deleted file when folder with same name exists in a different case
        Given using <dav-path-version> DAV path
        And user "Alice" has created folder "new"
        And user "Alice" has uploaded file with content "content" to "new/test.txt"
        And user "Alice" has deleted folder "new"
        And user "Alice" has created folder "new"
        And user "Alice" has uploaded file with content "new content" to "new/new-file.txt"
        When user "Alice" restores the folder with original path "/new" to "/new (1)" using the trashbin API
        Then the HTTP status code should be "201"
        And as "Alice" folder "new (1)" should exist
        And as "Alice" file "new (1)/test.txt" should exist
        And as "Alice" folder "new" should exist
        And as "Alice" file "new/new-file.txt" should exist
        Examples:
          | dav-path-version |
          | spaces           |
          | new              |
    

    diving deeper, I found that propfind of personal space has 2 new folders

    Image

    I start to open folder new and see that it's one fileId

    https://localhost:9200/files/spaces/personal/alice/new?fileId=12482e33-5541-4d2c-898f-b1fd6f3bc70e%2451f8ea54-5746-46d7-83bf-34502c922205%210e32d009-8396-4138-9503-8907f2ebd415&items-per-page=100&files-spaces-generic-view-mode=resource-tiles&tiles-size=2

    I replace new with new (1) and fileId in the URL and get the lost file. -> Now that explains why the test is green.

    https://localhost:9200/files/spaces/personal/alice/new%20(1)?fileId=12482e33-5541-4d2c-898f-b1fd6f3bc70e%2451f8ea54-5746-46d7-83bf-34502c922205%210cfc476e-83a5-47a7-916a-411756802388&items-per-page=100&files-spaces-generic-view-mode=resource-tiles&tiles-size=2

    Image

    Actual: Propfind request of personal space returns wrong <oc:name>new</oc:name> and
    <d:href>/remote.php/dav/spaces/12482e33-5541-4d2c-898f-b1fd6f3bc70e$51f8ea54-5746-46d7-83bf-34502c922205/new/</d:href> so we see on web 2 folders new. oc:fileid is correct

    Expected: Propfind request of personal space returns correct response with correct name. then we can see on web two folders new and new (1)

  13. added a commit that references this issue on Oct 14, 2025
  14. fschade commented on Oct 14, 2025

    @fschade
    Member

    Update: I have a solution that seems to be working as it should, but before I can give the all-clear, I'll have to write unit tests! Cant guarantee to have it done by today, expect the solution tomorrow!

    There's no data loss in my test cases!!!

    FYI: @dragotin, @ScharfViktor, @dragonchaser, and @tammi-23

  15. self-assigned this
    on Oct 24, 2025
  16. added a commit that references this issue on Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions