liberodark / ODrive

Google Drive GUI for Windows / Mac / Linux
https://liberodark.github.io/ODrive/
GNU General Public License v3.0
1.16k stars 136 forks source link

[BUG] Photo with duplicate names causes ENOENT error #132

Open nophead opened 5 years ago

nophead commented 5 years ago

Describe the bug When files are uploaded to Google Photos they are named from the filename, regardless of whether it is unique. If they linked to GoogleDrive and synced to a Windows machine then Google renames them name(1), name(2), etc, to prevent a name clash in a conventional filesystem.

ODrive seems to be missing this rename functionality and goes wrong.

To Reproduce Upload several different photos with the same file name to Google Photos. Enable the Google option to put Google Photos on Google Drive. Attempt to synchronise with ODrive.

Expected behavior The files should be suffixed (1), (2), etc to prevent name clashes.

Screenshots This is what appears in the terminal when run from the command line.

Downloading #1678 long cable.JPG
Downloading #1679 LCR meter.JPG
Downloading #1680 blower_bottom.JPG
Downloading #1681 blower_top.JPG
Downloading #1682 fanmap_radial_2d.png
Downloading #1683 duct.png
Downloading #1684 fanmap_danielbull_2d.png
Downloading #1685 duct.png
Downloading #1686 fanmap_40_2d.png
Downloading #1687 duct.png
File in local path with same md5 already existing
File in local path with same md5 already existing
File in local path with same md5 already existing
File in local path with same md5 already existing
File in local path with same md5 already existing
File in local path with same md5 already existing
File in local path with same md5 already existing
Done downloading file.
Downloaded duct.png!
ignoring events for path /home/chrisp/GoogleDrive/Google Photos/laser_driver.JPG
Done downloading file.
Unhandled rejection ENOENT: no such file or directory, rename '/home/chrisp/GoogleDrive/.duct.png.tmp' -> '/home/chrisp/GoogleDrive/Google Photos/duct.png'
{ [Error: ENOENT: no such file or directory, rename '/home/chrisp/GoogleDrive/.duct.png.tmp' -> '/home/chrisp/GoogleDrive/Google Photos/duct.png']
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/home/chrisp/GoogleDrive/.duct.png.tmp',
  dest: '/home/chrisp/GoogleDrive/Google Photos/duct.png' }
Done downloading file.
Unhandled rejection ENOENT: no such file or directory, rename '/home/chrisp/GoogleDrive/.duct.png.tmp' -> '/home/chrisp/GoogleDrive/Google Photos/duct.png'
{ [Error: ENOENT: no such file or directory, rename '/home/chrisp/GoogleDrive/.duct.png.tmp' -> '/home/chrisp/GoogleDrive/Google Photos/duct.png']
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/home/chrisp/GoogleDrive/.duct.png.tmp',
  dest: '/home/chrisp/GoogleDrive/Google Photos/duct.png' }
ignoring events for path /home/chrisp/GoogleDrive/Google Photos/duct.png

Synchronisation then seems to hang.

Desktop: