From 14a271417ba0ed7fdff0211602858d5aa3139f5b Mon Sep 17 00:00:00 2001 From: feiniks <36756310+feiniks@users.noreply.github.com> Date: Mon, 8 Aug 2022 16:29:37 +0800 Subject: [PATCH] Using json file format (#67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 杨赫然 --- seafdav_tests/test_webdav.py | 4 ++-- wsgidav/seafile_dav_provider.py | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/seafdav_tests/test_webdav.py b/seafdav_tests/test_webdav.py index ce3f8f7..9750efc 100644 --- a/seafdav_tests/test_webdav.py +++ b/seafdav_tests/test_webdav.py @@ -98,13 +98,13 @@ def _test_under_path(path): # delete non existent folder from webapi dirname = 'folder-%s' % randstring() - api.del_file(repo.get('id'), parent_dir, dirname, USER) + api.del_file(repo.get('id'), parent_dir, '[\"'+dirname+'\"]', USER) entries = davclient.repo_listdir(repo, parent_dir) self.assertEmpty(entries) #delete non existent file from webapi fname = 'uploaded-file-%s.txt' % randstring() - api.del_file(repo.get('id'), parent_dir, fname, USER) + api.del_file(repo.get('id'), parent_dir, '[\"'+fname+'\"]', USER) entries = davclient.repo_listdir(repo, parent_dir) self.assertEmpty(entries) diff --git a/wsgidav/seafile_dav_provider.py b/wsgidav/seafile_dav_provider.py index 278f083..63300e2 100644 --- a/wsgidav/seafile_dav_provider.py +++ b/wsgidav/seafile_dav_provider.py @@ -257,7 +257,7 @@ def handle_delete(self): return True parent, filename = os.path.split(self.rel_path) - seafile_api.del_file(self.repo.id, parent, filename, self.username) + seafile_api.del_file(self.repo.id, parent, '[\"'+filename+'\"]', self.username) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg) @@ -290,10 +290,10 @@ def handle_move(self, dest_path): # some clients such as GoodReader requires "overwrite" semantics file_id_dest = seafile_api.get_file_id_by_path(dest_repo.id, rel_path) if file_id_dest != None: - seafile_api.del_file(dest_repo.id, dest_dir, dest_file, self.username) + seafile_api.del_file(dest_repo.id, dest_dir, '[\"'+dest_file+'\"]', self.username) - seafile_api.move_file(self.repo.id, src_dir, src_file, - dest_repo.id, dest_dir, dest_file, 1, self.username, NEED_PROGRESS, SYNCHRONOUS) + seafile_api.move_file(self.repo.id, src_dir, '[\"'+src_file+'\"]', + dest_repo.id, dest_dir, '[\"'+dest_file+'\"]', 1, self.username, NEED_PROGRESS, SYNCHRONOUS) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg) @@ -325,8 +325,8 @@ def handle_copy(self, dest_path, depth_infinity): if not seafile_api.is_valid_filename(dest_repo.id, dest_file): raise DAVError(HTTP_BAD_REQUEST) - seafile_api.copy_file(self.repo.id, src_dir, src_file, - dest_repo.id, dest_dir, dest_file, self.username, NEED_PROGRESS, SYNCHRONOUS) + seafile_api.copy_file(self.repo.id, src_dir, '[\"'+src_file+'\"]', + dest_repo.id, dest_dir, '[\"'+dest_file+'\"]', self.username, NEED_PROGRESS, SYNCHRONOUS) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg) @@ -493,7 +493,7 @@ def handle_delete(self): if not filename: raise DAVError(HTTP_BAD_REQUEST) - seafile_api.del_file(self.repo.id, parent, filename, self.username) + seafile_api.del_file(self.repo.id, parent, '[\"'+filename+'\"]', self.username) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg) @@ -526,8 +526,8 @@ def handle_move(self, dest_path): if not seafile_api.is_valid_filename(dest_repo.id, dest_file): raise DAVError(HTTP_BAD_REQUEST) - seafile_api.move_file(self.repo.id, src_dir, src_file, - dest_repo.id, dest_dir, dest_file, 0, self.username, NEED_PROGRESS, SYNCHRONOUS) + seafile_api.move_file(self.repo.id, src_dir, '[\"'+src_file+'\"]', + dest_repo.id, dest_dir, '[\"'+dest_file+'\"]', 0, self.username, NEED_PROGRESS, SYNCHRONOUS) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg) @@ -560,8 +560,8 @@ def handle_copy(self, dest_path, depth_infinity): if not seafile_api.is_valid_filename(dest_repo.id, dest_file): raise DAVError(HTTP_BAD_REQUEST) - seafile_api.copy_file(self.repo.id, src_dir, src_file, - dest_repo.id, dest_dir, dest_file, self.username, NEED_PROGRESS, SYNCHRONOUS) + seafile_api.copy_file(self.repo.id, src_dir, '[\"'+src_file+'\"]', + dest_repo.id, dest_dir, '[\"'+dest_file+'\"]', self.username, NEED_PROGRESS, SYNCHRONOUS) except SearpcError as e: raise DAVError(HTTP_INTERNAL_ERROR, e.msg)