owncloud / owncloud/core

Trying to restore files via webDAV has apparently caused DB/filesystem conflicts

Open
#38,265 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Bug
Dominant language
PHP
Stars
8.8k
Forks
2.1k
Avg merge
20h 7m
Merged PRs (30d)
41

Description

Per the documentation, I am trying to restore files by ID, using the TrashBin API. The format I am using:

curl "http://owncloud.server/remote.php/dav/trash-bin/user1/1234567/" \
  -H 'Overwrite: F' \
  -H 'Destination: http://owncloud.server/remote.php/dav/files/user1/Graphics/BMP/file001.bmp' \
  -X MOVE \
  --user "user1:pass"

When attempting this, I receive an error that the "destination node already exists". However, the file is still in the trash directory and it is not in the Destination directory. I don't know where to find the node in the database but it does not exist anywhere on the filesystem, outside of the trash.

Expected behaviour

The file is restored.

Actual behaviour

I receive an error:
The destination node already exists

Steps to reproduce

This issue appeared when trying to restore 200,000 files, using the TrashBin DAV API.
Per the documentation, calls used the file ID and a target path.
Around 180,000 succeeded and the rest seem to have this issue.

Server configuration

Operating system: Linux
Web server: Apache
Database: MaraiDB
PHP version: 7.3
ownCloud version: 10.5.0

Client configuration

N/A

Logs

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TrashBin DAV API handling of MOVE requests with an ID and destination path, then reproduce the conflict using the documented curl request. Check how the destination node is detected when the file remains in trash. Done means the file is restored to the target path without a false existing-node error.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, linux, mariadb, php
Domain
api, backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.