desktop icon indicating copy to clipboard operation
desktop copied to clipboard

[Bug]: Removing a directory containing directory junction results in data loss

Open Amunak opened this issue 2 years ago • 0 comments

Bug description

Removing a synced directory that contains a directory junction recursively deletes content within that directory junction, resulting in file removal (data loss) outside the Nextcloud-managed (synced) folder.

I feel like #4232 should be a much higher priority.

Steps to reproduce

  1. Have a directory structure with valuable data somewhere on your PC and create an NTFS Directory Junction in your Nextcloud folder:
D:
|-data
| `-subfolder
|   `-valuable data.txt
`-Nextcloud
  `-whatever
    `-junction to D-data
  1. Wait for it to sync and observe that the junction is (correctly) not synced, so on a synced system or web only an empty folder whatever/ exists. This to me indicates that Nextcloud knows it's a junction and doesn't want to touch it, which is intuitive and expected.
  2. On a different synced system or from Nexctcloud FIles on Web remove folder whatever.
  3. Observe that folder D:\\Nextcloud\\whatever correctly disappeared. More importantly observe that D:\\data\\subfolder disappeared as well, and that your valuable data are gone.

Expected behavior

The directory junction should be removed (unlinked), but the data inside must not be deleted.

Alternatively not deleting the junction or the parent folder and only emitting an error and not syncing the parent folder would be acceptable as well.

Which files are affected by this bug

whatever

Operating system

Windows

Which version of the operating system you are running.

Windows 10

Package

Official install

Nextcloud Server version

23.0.5

Nextcloud Desktop Client version

3.5.2

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 3.3.6 to 3.4.0)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • [X] Default internal user-backend

Amunak avatar Jul 22 '22 12:07 Amunak