Skip to content

Commit

Permalink
fix app provider new file action and improve app provider error codes (
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek authored Dec 9, 2021
1 parent 66071c8 commit 68b64bf
Show file tree
Hide file tree
Showing 19 changed files with 449 additions and 248 deletions.
8 changes: 8 additions & 0 deletions changelog/unreleased/app-provider-new-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Change: Fix app provider new file creation and improved error codes

We've fixed the behavior for the app provider when creating new files.
Previously the app provider would overwrite already existing files when creating a new file, this is now handled and prevented.
The new file endpoint accepted a path to a file, but this does not work for spaces. Therefore we now use the resource id of the folder where the file should be created and a filename to create the new file.
Also the app provider returns more useful error codes in a lot of cases.

https://github.com/cs3org/reva/pull/2210
7 changes: 5 additions & 2 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageprovider.ResourceI

// we did not find a default provider
if res.Status.Code == rpc.Code_CODE_NOT_FOUND {
err := errtypes.NotFound(fmt.Sprintf("gateway: default app rovider for mime type:%s not found", ri.MimeType))
err := errtypes.NotFound(fmt.Sprintf("gateway: default app provider for mime type:%s not found", ri.MimeType))
return nil, err
}

Expand Down Expand Up @@ -285,7 +285,10 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageprovider.ResourceI
}
res.Providers = filteredProviders

// if we only have one app provider we verify that it matches the requested app name
if len(res.Providers) == 0 {
return nil, errtypes.NotFound(fmt.Sprintf("app '%s' not found", app))
}

if len(res.Providers) == 1 {
return res.Providers[0], nil
}
Expand Down
Loading

0 comments on commit 68b64bf

Please sign in to comment.