Skip to content

Dropbox plugin: error handling if the `location` param refers to the non-existing directory

If you create a container with Dropbox storage attached, that has location pointing to some non-existing directory:

version: '1'
object: container
owner: '0xd7032b69d84acd834397bd336f225f46fabe6c22703380089c42987831acc963'
paths:
- /.uuid/73e7ee69-9500-4896-b528-543320823603
- /blah
title: null
categories: []
backends:
  storage:
  - object: storage
    type: dropbox
    location: /non-exiting-dropbox-subdir
    app-key: <PRIVATE>
    refresh-token: <PRIVATE>
    backend-id: d1c5050f-00e5-4ea3-9586-86e00c2d0a88

you will experience the following error on most of the file system operations (like cp, ls etc.):

cp: cannot stat '/home/user/wildland/something': Invalid argument

Under the hood the exception is thrown, e.g. while copying I got the following one (log from ~/.local/share/wildland/wl-fuse.log):

2021-12-08 19:58:10,475 [231/Dummy-1] ERROR [fuse] error while handling getattr
Traceback (most recent call last):
  File "/home/user/wildland-client/wildland/fuse_utils.py", line 88, in wrapper
    ret = func(*args, **kwds)
  File "/home/user/wildland-client/wildland/fs.py", line 105, in getattr
    return self._mapattr(super().getattr(path))
  File "/home/user/wildland-client/wildland/fs_base.py", line 528, in getattr
    attr, res = self.resolver.getattr_extended(PurePosixPath(path))
  File "/home/user/wildland-client/wildland/conflict.py", line 348, in getattr_extended
    st = handle_io_error(self.storage_getattr, res.ident, res.relpath)
  File "/home/user/wildland-client/wildland/conflict.py", line 470, in handle_io_error
    return func(*args)
  File "/home/user/wildland-client/wildland/fs_base.py", line 669, in storage_getattr
    attr = storage.getattr(relpath)
  File "/home/user/wildland-client/wildland/storage_backends/cached.py", line 306, in getattr
    self._update_dir(path.parent)
  File "/home/user/wildland-client/wildland/storage_backends/cached.py", line 253, in _update_dir
    self._refresh_dir(path)
  File "/home/user/wildland-client/wildland/storage_backends/cached.py", line 268, in _refresh_dir
    for file_path, attr in self.info_dir(path):
  File "/home/user/env/lib/python3.9/site-packages/wildland_dropbox/backend.py", line 273, in info_dir
    for metadata in self.client.list_folder(self._path(path)):
  File "/home/user/env/lib/python3.9/site-packages/wildland_dropbox/dropbox_client.py", line 102, in list_folder
    listing = self.connection.files_list_folder(path_str)
  File "/home/user/env/lib/python3.9/site-packages/dropbox/base.py", line 1952, in files_list_folder
    r = self.request(
  File "/home/user/env/lib/python3.9/site-packages/dropbox/dropbox_client.py", line 348, in request
    raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('4f1ef3ee7f85457fb0dd60a75214b8df', ListFolderError('path', LookupError('n
ot_found', None)))

I guess that other type of backends that have location param, may experience the same problem. Please check it while working on it.

Edited by Patryk Bęza