mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
[web-api] Check if dir existes before copy file
This commit is contained in:
@@ -1140,6 +1140,10 @@ class OpCopyView(APIView):
|
|||||||
return api_error(status.HTTP_400_BAD_REQUEST,
|
return api_error(status.HTTP_400_BAD_REQUEST,
|
||||||
'Missing argument.')
|
'Missing argument.')
|
||||||
|
|
||||||
|
if seafile_api.get_dir_id_by_path(repo_id, parent_dir) is None or \
|
||||||
|
seafile_api.get_dir_id_by_path(repo_id, dst_dir) is None:
|
||||||
|
return api_error(status.HTTP_400_BAD_REQUEST, 'Path does not exist.')
|
||||||
|
|
||||||
parent_dir_utf8 = parent_dir.encode('utf-8')
|
parent_dir_utf8 = parent_dir.encode('utf-8')
|
||||||
for file_name in file_names.split(':'):
|
for file_name in file_names.split(':'):
|
||||||
file_name = unquote(file_name.encode('utf-8'))
|
file_name = unquote(file_name.encode('utf-8'))
|
||||||
|
Reference in New Issue
Block a user