Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CryptSync & DropBox - conflicted copy issue #22

Open
rioser opened this issue May 3, 2019 · 4 comments
Open

CryptSync & DropBox - conflicted copy issue #22

rioser opened this issue May 3, 2019 · 4 comments

Comments

@rioser
Copy link

rioser commented May 3, 2019

I've run into one semi-serious issue in combination with Dropbox. Occasionally, probably because of some mistake on my part, Dropbox creates a copy of a file, and to avoid overwriting the previous copy, the new copy is renamed. However, one version of these conflicting copies is still overwritten by another when decrypted by CryptSync. Let me demonstrate this issue by the following example:

  1. I have a file titled "shopping history.xlsx"

  2. CrypSync encrypts this file, resulting in a file titled "shopping history.xlsx.7z" (which contains "shopping history.xlsx")

This file is then uploaded to Dropbox.

  1. Dropbox detects a syncing conflict in this file (perhaps because I edited the file "shopping history.xlsx" while being offline on one PC and then again edited the same file while online on another PC), and because Dropbox cannot decide which of these files to keep, it keeps both. The second file is renamed to prevent overwriting, resulting in the file titled in the following manner:

"shopping history.xlsx (DESKTOP-UMS014A's conflicted copy 2019-04-24).7z"
(which also contains the file "shopping history.xlsx")

The problem occurs when both of these files ("shopping history.xlsx.7z" and "shopping history.xlsx (DESKTOP-UMS014A's conflicted copy 2019-04-24).7z") are downloaded into my PC and subsequently decrypted via CryptSync. During this process, one version of the file is overwritten by another, because both zipped files contain the file of the same title.

It would be really helpful if CryptSync didn't overwrite these conflicted files, but rather keep both of them, for instance by renaming the second copy. Otherwise I am kind of kept in the dark about the existence of this conflict. This time it took me about a week until I noticed something was wrong.

Thank you in advance for looking into this issue and also thanks for a great, simple and efficient piece of software.

@HikariWS
Copy link

This is a very important issue! As we might end up editing the same file on multiple places and keep making diffs and even overwriting and losing some content!

Sadly IDK if there's a proper solution for it, as each cloud storage handles conflicts differently.

CryptSync would need to identify when a encrypted file is copied with another name, and create a method of making both files available without risking creating another conflict.

@Kaligula0
Copy link

Kaligula0 commented Dec 27, 2022

Yes, this is a VERY IMPORTANT issue! There's also an error when user has filename encryption on. CryptSync fails to decrypt a file which:

  1. filename is encrypted to "320929da9fa09f…etc"
  2. filename has a "(DESKTOP-UMS014A's conflicted copy 2019-04-24)" appended by Dropbox
  3. so it's filename is "320929da9fa09f…etc (DESKTOP-UMS014A's conflicted copy 2019-04-24).cryptsync" (or ".7z").

In this case the user also is not aware of conflict copies because decrypt FAILs are not announced by the app (one has to manually open the app and monitor status).

Has anybody come with any workaround like e.g. watching the encrypted folder for changes with PowerShell or sth?

@Kaligula0
Copy link

I'd say it's a CRITICAL issue, because it results in loss of data without any notification, because of a known problem.

@Kaligula0
Copy link

Kaligula0 commented Dec 30, 2022

I temporarily use a workaround. I watch for new files (named "conflicted copy" in Dropbox folder) with a PowerShell Watcher script. It at least informs user that a wild* "conflicted copy" appeared.

With Windows Scheduler I set the script to start on user login and run in background. (New task → Action → app/script = powershell and arguments = -WindowStyle Hidden -file "C:\Path\to\script.ps1").

Here's the code of script.ps1:

# SETTINGS
$host.ui.RawUI.WindowTitle = "CryptSync Folder Watcher for Dropbox conflict copies"
$homeDir = 'C:\path\to\Dropbox\'
$filter = '*conflicted copy*.cryptsync'

# INIT WATCHER
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $homeDir
$watcher.Filter = $filter
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
$action =
{
    $path = $event.SourceEventArgs.FullPath
    $name = $event.SourceEventArgs.Name
    $changetype = $event.SourceEventArgs.ChangeType
    $msg = """Conflicted copy"" was $changetype `n$(get-date) `n`nFile:`n""$name""`n`nFullpath:`n$path"
    $popupTitle = """Conflicted copy"" was $changetype"
    Write-Host $msg
    [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
    [System.Windows.Forms.MessageBox]::Show($msg,$popupTitle,0,48)
}

# START WATCHER
Register-ObjectEvent $watcher 'Created' -Action $action
Register-ObjectEvent $watcher 'Changed' -Action $action
Register-ObjectEvent $watcher 'Deleted' -Action $action
Register-ObjectEvent $watcher 'Renamed' -Action $action

# TEST WATCHER (CREATE NEW FILE)
# Let's create a new file there and see what happens:
#  $null = New-Item -path 'C:\path\to\Dropbox\shopping history.xlsx (DESKTOP-UMS014A's conflicted copy 2019-04-24).cryptsync' -ItemType File

# PAUSE CONSOLE
# (so it doesn't close right after registering Watcher)
while ($true) {sleep 5}

*) who's gotta know, will know ;)

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

No branches or pull requests

3 participants