-
Notifications
You must be signed in to change notification settings - Fork 113
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
Fix recycle to different location #1541
Fix recycle to different location #1541
Conversation
3c8006e
to
6f79f53
Compare
9075f6c
to
ab76e87
Compare
@labkode @ishank011 I implemented the fix for the Note: Integration tests are currently still failing because of #1576 |
@aduffeck sure, I'll take it up this week. |
@ishank011 awesome, thank you 👍 |
ab76e87
to
fff301e
Compare
This is specified in the CS3 APIs as the "restore_path" field of the "RestoreRecycleItemRequest" resource but wasn't implemented in the storage provider until now.
fff301e
to
a1ecd7f
Compare
if restorePath == "" { | ||
v, err := xattr.Get(src, trashOriginPrefix) | ||
if err != nil { | ||
log.Error().Err(err).Str("key", key).Str("path", src).Msg("could not read origin") |
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.
Shouldn't we return here? Because if err != nil
, restorePath
will be the base of src, restoring to which might create conflicts
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.
It also restored to /
before, I didn't want to change behaviour like that with this PR.
Having said that I think the origin xattr will only be missing in very bad exceptions anyway. In those cases it might be desirable to have the files restored to /
(if possible), no?
@@ -63,7 +63,7 @@ type Tree interface { | |||
// CreateReference(ctx context.Context, node *node.Node, targetURI *url.URL) error | |||
Move(ctx context.Context, oldNode *node.Node, newNode *node.Node) (err error) | |||
Delete(ctx context.Context, node *node.Node) (err error) | |||
RestoreRecycleItemFunc(ctx context.Context, key string) (*node.Node, func() error, error) | |||
RestoreRecycleItemFunc(ctx context.Context, key, targetPath string) (*node.Node, func() error, error) |
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.
Can you change it to restorePath
to maintain consistency?
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.
@ishank011 👍, done
Restoring to a different location than the original one is specified in the CS3 APIs as the
restore_path
field of theRestoreRecycleItemRequest
resource but wasn't implemented in the storage provider until now.