iwonbigbro / gsync

RSync for Google Drive - GSync
Other
238 stars 50 forks source link

When downloading the destination folder is added twice to the path, resulting in failure #84

Closed arne309 closed 2 years ago

arne309 commented 9 years ago

When syncing from drive to local storage and using a relative destination path other than the current directory, the file names contain the destination path twice, resulting in an Error. Directories are created correctly.

Tested with commit 03db22fe826f073e56877918b0acb7b4ba908f18

Example:

Google Drive has the directory /Test with a file named MyFile.txt. The local destination folder is empty.

$ python gsync/bin/gsync -r -t -v drive:///Test/ ./destinationfolder/
./
MyFile.txt
DEBUG: IOError(2, 'No such file or directory'): [Errno 2] No such file or directory: u'destinationfolder/destinationfolder/MyFile.txt'
DEBUG: IOError(2, 'No such file or directory'):   File "/home/ubuntu/tests/gsync/gsync/libgsync/crawler.py", line 193, in run
    self._walk(srcpath, self._walk_callback, self._dev)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/crawler.py", line 163, in _walk
    self._sync(absfile)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/sync/__init__.py", line 263, in __call__
    self._sync(path)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/sync/__init__.py", line 315, in _sync
    self.dst.create(dst_path, src_file)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/sync/file/__init__.py", line 453, in create
    self.__create_file(path, src_obj)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/sync/file/__init__.py", line 353, in __create_file
    self._update_data(path, src)
  File "/home/ubuntu/tests/gsync/gsync/libgsync/sync/file/local/__init__.py", line 197, in _update_data
    fd = open(path, "w")

Error: IOError(2, 'No such file or directory')
sent 0 bytes  received 0 bytes  0.00 bytes/sec

Relevant part of the debug output:

DEBUG:         drive/:686:stat(): Found u'drive://Test/MyFile.txt'
DEBUG:        sync/file/remote/:92:get_info(): Remote mtime: SyncFileInfoDatetime(datetime.datetime(2015, 1, 24, 19, 3, 41, tzinfo=tzutc()))
DEBUG:       sync/:285:_sync(): force_dest_file = False
DEBUG:         sync/file/:306:get_path(): Joining: 'destinationfolder' with u'MyFile.txt'
DEBUG:         sync/file/:306:get_path(): Joining: 'destinationfolder' with u'MyFile.txt'
DEBUG:        sync/file/local/:42:get_info(): Fetching local file metadata: u'destinationfolder/MyFile.txt'
DEBUG:        sync/file/local/:79:get_info(): File not found: u'destinationfolder/MyFile.txt'
MyFile.txt
DEBUG:         sync/file/:411:_normalise_source(): type(src) = <class 'libgsync.sync.file.SyncFileInfo'>
DEBUG:           drive/:281:__init__(): Initialising drive
DEBUG:           drive/:289:__init__(): Initialisation complete
DEBUG:             drive/:281:__init__(): Initialising drive
DEBUG:             drive/:289:__init__(): Initialisation complete
DEBUG:           sync/file/:306:get_path(): Joining: 'destinationfolder' with u'destinationfolder/MyFile.txt'
DEBUG:          sync/file/local/:167:_create_file(): Creating local file: u'destinationfolder/destinationfolder/MyFile.txt'
DEBUG:          sync/file/local/:175:_create_file(): Creation failed: IOError(2, 'No such file or directory')
DEBUG:           sync/file/:306:get_path(): Joining: 'destinationfolder' with u'destinationfolder/MyFile.txt'
DEBUG:            sync/file/:306:get_path(): Joining: 'destinationfolder' with u'destinationfolder/destinationfolder/MyFile.txt'
DEBUG:           sync/file/local/:42:get_info(): Fetching local file metadata: u'destinationfolder/destinationfolder/destinationfolder/MyFile.txt'
DEBUG:           sync/file/local/:79:get_info(): File not found: u'destinationfolder/destinationfolder/destinationfolder/MyFile.txt'