cli: restore single item from trash bin, listing on empty thrash bin

This commit is contained in:
Alex Ababii committed 2026-09-01 10:03:34 +02:00
1 parent 7d4c6d6524
commit 983c836653
3 files changed
+6 -9

No files matched your search

@@ -306,8 +306,13 @@ func restoreTrashBinItem(cfg *config.Config) *cobra.Command {
var found bool
var itemRef *provider.RecycleItem
rid, err := storagespace.ParseID(itemID)
if err != nil {
return err
}
opaqueID := rid.GetOpaqueId()
for _, item := range res.GetRecycleItems() {
if item.GetKey() == itemID {
if item.GetKey() == opaqueID {
itemRef = item
found = true
break
@@ -350,10 +355,6 @@ func listRecycle(ctx context.Context, client gateway.GatewayAPIClient, ref provi
if res.Status.Code != rpc.Code_CODE_OK {
return nil, fmt.Errorf("%s %s", _retrievingErrorMsg, res.Status.Code)
}
if len(res.GetRecycleItems()) == 0 {
fmt.Errorf("The trash-bin is empty. Nothing to restore")
os.Exit(0)
}
return res, nil
}
@@ -337,8 +337,6 @@ _ocdav: api compatibility, return correct status code_
#### [POSIX: failing CLI commands](https://github.com/opencloud-eu/opencloud/issues/3095)
- [cliCommands/restoreTrashBinItems.feature:11](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/restoreTrashBinItems.feature#L11)
- [cliCommands/restoreTrashBinItems.feature:23](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/restoreTrashBinItems.feature#L23)
- [cliCommands/sharesCleanup.feature:12](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/sharesCleanup.feature#L12)
### notification issue #323
@@ -339,8 +339,6 @@ _ocdav: api compatibility, return correct status code_
#### [POSIX: failing CLI commands](https://github.com/opencloud-eu/opencloud/issues/3095)
- [cliCommands/restoreTrashBinItems.feature:11](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/restoreTrashBinItems.feature#L11)
- [cliCommands/restoreTrashBinItems.feature:23](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/restoreTrashBinItems.feature#L23)
- [cliCommands/sharesCleanup.feature:12](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/sharesCleanup.feature#L12)
### notification issue #323