1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 10:26:17 +00:00

[web-api] Check if dir existes before copy file

This commit is contained in:
lian
2015-03-05 15:24:47 +08:00
parent a9a2f8a6aa
commit f63d6aab6e

View File

@@ -1140,6 +1140,10 @@ class OpCopyView(APIView):
return api_error(status.HTTP_400_BAD_REQUEST,
'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')
for file_name in file_names.split(':'):
file_name = unquote(file_name.encode('utf-8'))