stefankueng / CryptSync

CryptSync is a small utility that synchronizes two folders while encrypting the contents in one folder. That means one of the two folders has all files unencrypted (the files you work with) and the other folder has all the files encrypted.
https://tools.stefankueng.com/CryptSync.html
GNU General Public License v3.0
400 stars 72 forks source link

Wrong detected counterpart of file #108

Closed Argimko closed 4 months ago

Argimko commented 1 year ago

Hi Stefan, thank you for fixing #105 - it works well now! :)

I have found another issue, I think.

I have folders: D:\Desktop\src with test.png.cryptsync file D:\Desktop\dst is empty

Now I want to mirror files: from -> to with pass, and skip encrypting *.cryptsync. So I run:

"%PROGRAMW6432%\CryptSync\CryptSync.exe" /src:"D:\Desktop\src" /dst:"D:\Desktop\dst" /cpy:"*.cryptsync" /pw:"1" /mirror /logpath:"D:\Desktop\log1.txt" (*)

Please, follow this:

  1. Make sure log1.txt does not exists or empty
  2. Put test.png.cryptsync to src folder. Folder dst is empty
  3. Run cmd as above (*)
  4. You will see that file correctly copied: D:\Desktop\src\test.png.cryptsync -> D:\Desktop\dst\test.png.cryptsync
  5. Keep log1.txt unchanged
  6. Run cmd as above (*) second time
  7. Now you will see the issue: for some reason file D:\Desktop\dst\test.png.cryptsync was removed.

My log file is:

Starting CryptSync
syncing folder orig "D:\Desktop\src" with crypt "D:\Desktop\dst"
settings: encrypt names: no, use 7z: no, use GPG: no, use FAT workaround: no, sync deleted: yes, reset archive attr: no
copy file \\?\D:\Desktop\src\test.png.cryptsync to \\?\D:\Desktop\dst\test.png.cryptsync
finished syncing folder orig "D:\Desktop\src" with crypt "D:\Desktop\dst"
exiting CryptSync

Starting CryptSync
syncing folder orig "D:\Desktop\src" with crypt "D:\Desktop\dst"
settings: encrypt names: no, use 7z: no, use GPG: no, use FAT workaround: no, sync deleted: yes, reset archive attr: no
copy file \\?\D:\Desktop\src\test.png.cryptsync to \\?\D:\Desktop\dst\test.png.cryptsync
counterpart of file test.png does not exist in src folder, delete file
finished syncing folder orig "D:\Desktop\src" with crypt "D:\Desktop\dst"
exiting CryptSync

The issue reproduced with CryptSync v1.4.4.462 and with not released master branch with the last commit 56efb2e.

Thank you!

stefankueng commented 4 months ago

the problem here is that you want to copy files with the .cryptsync extension. That extension is used for the encrypted files. As soon as the file test.png.cryptsync was copied to the dest folder, it get's treated as an encrypted file for test.png.

Just don't mess around with .cryptsync files.