-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api] Refactor /move API with additional validation checks #3991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
# Check if destination path is parent of source path | ||
if _is_destination_parent_of_source(request, source_path, destination_path): | ||
return HttpResponse('Destination cannot be the parent directory of source.', status=400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not the same as identical paths above? I take it it's different for folders but the message could be the same "Source and destination must be different"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I feel from API perspective, the original error message makes sense here and clearly explains the issue.
Assume you are hitting the API with source and destination path which are different but still you get the message that Source and destination must be different
which feels vague and will require extra effort to figure out that the parent path cannot be same because that'd make move operation in same directory.
What do you think?
48e5adc
to
8e473d5
Compare
What changes were proposed in this pull request?
How was this patch tested?