-
Notifications
You must be signed in to change notification settings - Fork 26
fix(upload): validate path #575
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
Conversation
|
@cnlangzi Actually this won't work. First of all, The other important missed point is, if there is already a file with path I had considered this as well. If you make this changes then I will drop my PR. |
fixed both of them. |
|
|
||
| // Path get current dir path | ||
| func (d *RefWalker) Path() string { | ||
| if d == nil { |
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.
Perhaps we should return error when d is nil, or when index is >= length, otherwise users will have to check the code to know what happened when the returned value is "".
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.
fixed
| } | ||
|
|
||
| // Parent get curerent parent path | ||
| func (d *RefWalker) Parent() string { |
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.
Same as Path(), we'd better return errors on "" strings
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.
fixed
| name: "nested directories", | ||
| path: "/dir1/dir2/dir3/file1", | ||
| items: []string{"dir1", "dir2", "dir3", "file1"}, | ||
| }, |
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.
Adding cases for empty subpath perhaps, e.g. /dir1/dir2//dir3///dir4
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.
fixed
|
@peterlimg let's close this PR. and @lpoli will fix this bug on his PR #571. please go to review his PR instead of it. thanks. |
Changes
Fixes
Tests
Tasks to complete before merging PR:
Associated PRs (Link as appropriate):