Skip to content
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

Merged
merged 6 commits into from
Apr 19, 2021

Conversation

aduffeck
Copy link
Contributor

@aduffeck aduffeck commented Mar 12, 2021

Restoring to a different location than the original one 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.

@aduffeck aduffeck force-pushed the fix-recycle-to-different-location branch 11 times, most recently from 3c8006e to 6f79f53 Compare March 18, 2021 09:50
@aduffeck aduffeck force-pushed the fix-recycle-to-different-location branch 6 times, most recently from 9075f6c to ab76e87 Compare March 22, 2021 12:12
@aduffeck
Copy link
Contributor Author

@labkode @ishank011 I implemented the fix for the localfs, owncloud, ocis and s3ng drivers. Would it be possible that - should you agree to the change - one of you does it for eosfs?

Note: Integration tests are currently still failing because of #1576

@ishank011
Copy link
Contributor

@aduffeck sure, I'll take it up this week.

@aduffeck
Copy link
Contributor Author

@ishank011 awesome, thank you 👍

@aduffeck aduffeck force-pushed the fix-recycle-to-different-location branch from ab76e87 to fff301e Compare March 23, 2021 09:01
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.
@aduffeck aduffeck force-pushed the fix-recycle-to-different-location branch from fff301e to a1ecd7f Compare March 29, 2021 07:26
@aduffeck aduffeck marked this pull request as ready for review April 9, 2021 12:23
@aduffeck aduffeck requested a review from labkode as a code owner April 9, 2021 12:23
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")
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishank011 👍, done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants