Skip to content

Commit 68b64bf

Browse files
authored
fix app provider new file action and improve app provider error codes (#2210)
1 parent 66071c8 commit 68b64bf

File tree

19 files changed

+449
-248
lines changed

19 files changed

+449
-248
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Change: Fix app provider new file creation and improved error codes
2+
3+
We've fixed the behavior for the app provider when creating new files.
4+
Previously the app provider would overwrite already existing files when creating a new file, this is now handled and prevented.
5+
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.
6+
Also the app provider returns more useful error codes in a lot of cases.
7+
8+
https://github.com/cs3org/reva/pull/2210

internal/grpc/services/gateway/appprovider.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageprovider.ResourceI
242242

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

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

288-
// if we only have one app provider we verify that it matches the requested app name
288+
if len(res.Providers) == 0 {
289+
return nil, errtypes.NotFound(fmt.Sprintf("app '%s' not found", app))
290+
}
291+
289292
if len(res.Providers) == 1 {
290293
return res.Providers[0], nil
291294
}

0 commit comments

Comments
 (0)