Skip to content

Commit

Permalink
Using json file format (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: 杨赫然 <heran.yang@seafile.com>
  • Loading branch information
2 people authored and imwhatiam committed Dec 24, 2022
1 parent 554855a commit e58e3cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions seafdav_tests/test_webdav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
22 changes: 11 additions & 11 deletions wsgidav/seafile_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit e58e3cc

Please sign in to comment.