-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove symlink, not target, in FileOp.Rm. #2474
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.
I think we should add a cap for that in case anyone wants to detect the behavior change.
@@ -146,10 +146,12 @@ func rm(ctx context.Context, d string, action pb.FileActionRm) error { | |||
} | |||
|
|||
func rmPath(root, src string, allowNotFound bool) error { | |||
p, err := fs.RootPath(root, filepath.Join("/", src)) | |||
dir, base := filepath.Split(src) |
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.
Clean()
the src
for safety before. And validate base
not empty?
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.
Done
Before this change, if the path provided to FileOp.Rm was a symlink then the target of the symlink would be removed instead of the symlink itself. Now, the symlink will be removed instead. However, any symlinks present in the parent dirs of the specified path will still be resolved before calling os.Remove; this change only results in the base of the specified path not being followed. Signed-off-by: Erik Sipsma <[email protected]>
94f2a2e
to
43a7426
Compare
Added a cap in the update that's set server-side, but should the client actually set that anywhere in any requests? Or is it just cap the server sets that users can query if they want? I'm not that familiar with the whole cap system and see pre-existing caps following both patterns, so not sure what's right here. |
Only if the client had an option like |
Before this change, if the path provided to FileOp.Rm was a symlink then
the target of the symlink would be removed instead of the symlink
itself. Now, the symlink will be removed instead. However, any symlinks
present in the parent dirs of the specified path will still be resolved
before calling os.Remove; this change only results in the base of the
specified path not being followed.
Signed-off-by: Erik Sipsma [email protected]