Skip to content

Commit

Permalink
check if can_create when create folder
Browse files Browse the repository at this point in the history
  • Loading branch information
imwhatiam committed Feb 11, 2025
1 parent f9e0c46 commit 9b43c32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions seahub/api2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3791,7 +3791,8 @@ def post(self, request, repo_id, format=None):
error_msg = 'Folder %s not found.' % parent_dir
return api_error(status.HTTP_404_NOT_FOUND, error_msg)

if parse_repo_perm(check_folder_permission(request, repo_id, parent_dir)).can_edit_on_web is False:
if parse_repo_perm(check_folder_permission(request, repo_id,
parent_dir)).can_create is False:
error_msg = 'Permission denied.'
return api_error(status.HTTP_403_FORBIDDEN, error_msg)

Expand All @@ -3811,7 +3812,8 @@ def post(self, request, repo_id, format=None):
return api_error(HTTP_520_OPERATION_FAILED,
'Failed to make directory.')
else:
if parse_repo_perm(check_folder_permission(request, repo_id, '/')).can_edit_on_web is False:
if parse_repo_perm(check_folder_permission(request, repo_id,
'/')).can_create is False:
error_msg = 'Permission denied.'
return api_error(status.HTTP_403_FORBIDDEN, error_msg)

Expand Down

0 comments on commit 9b43c32

Please sign in to comment.