duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #04620
[Merge] lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity
Eugene Crosser has proposed merging lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
For more details, see:
https://code.launchpad.net/~crosser/duplicity/dpbx-fix-file-listing/+merge/334274
dpbxbackend: do not crash when remote directory is empty (always empty on first run).
--
Your team duplicity-team is requested to review the proposed merge of lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity.
=== modified file 'duplicity/backends/dpbxbackend.py'
--- duplicity/backends/dpbxbackend.py 2017-07-11 14:55:38 +0000
+++ duplicity/backends/dpbxbackend.py 2017-11-25 12:19:19 +0000
@@ -41,7 +41,7 @@
from dropbox import Dropbox
from dropbox.exceptions import AuthError, BadInputError, ApiError
from dropbox.files import UploadSessionCursor, CommitInfo, WriteMode, \
- GetMetadataError, DeleteError, UploadSessionLookupError
+ GetMetadataError, DeleteError, UploadSessionLookupError, ListFolderError
from dropbox.oauth import DropboxOAuth2FlowNoRedirect
from requests.exceptions import ConnectionError
import time
@@ -383,15 +383,19 @@
remote_dir = '/' + urllib.unquote(self.parsed_url.path.lstrip('/')).rstrip()
log.Debug('dpbx.files_list_folder(%s)' % remote_dir)
- resp = self.api_client.files_list_folder(remote_dir)
- log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
-
res = []
- while True:
- res.extend([entry.name for entry in resp.entries])
- if not resp.has_more:
- break
- resp = self.api_client.files_list_folder_continue(resp.cursor)
+ try:
+ resp = self.api_client.files_list_folder(remote_dir)
+ log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
+
+ while True:
+ res.extend([entry.name for entry in resp.entries])
+ if not resp.has_more:
+ break
+ resp = self.api_client.files_list_folder_continue(resp.cursor)
+ except ApiError as e:
+ if not isinstance(e.error, ListFolderError):
+ raise
# Warn users of old version dpbx about automatically renamed files
self.check_renamed_files(res)
Follow ups