From 0252e73f0d615212db7d917cfa1254fa3cf71034 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Fri, 13 May 2022 16:37:14 +0200 Subject: [PATCH] fix creating new files with wopi --- changelog/unreleased/fix-wopi-new-file.md | 6 ++++++ internal/http/services/appprovider/appprovider.go | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/fix-wopi-new-file.md diff --git a/changelog/unreleased/fix-wopi-new-file.md b/changelog/unreleased/fix-wopi-new-file.md new file mode 100644 index 0000000000..b2bbc9420d --- /dev/null +++ b/changelog/unreleased/fix-wopi-new-file.md @@ -0,0 +1,6 @@ +Bugfix: Fix creating a new file with wopi + +Fixed a bug in the appprovider which prevented creating new files. + +https://github.com/owncloud/ocis/issues/3505 +https://github.com/cs3org/reva/pull/2869 diff --git a/internal/http/services/appprovider/appprovider.go b/internal/http/services/appprovider/appprovider.go index 06cda3b13c..eafe54ba80 100644 --- a/internal/http/services/appprovider/appprovider.go +++ b/internal/http/services/appprovider/appprovider.go @@ -129,13 +129,13 @@ func (s *svc) handleNew(w http.ResponseWriter, r *http.Request) { return } - parentContainerID := r.URL.Query().Get("parent_container_id") - if parentContainerID == "" { + parentContainerIDStr := r.URL.Query().Get("parent_container_id") + if parentContainerIDStr == "" { writeError(w, r, appErrorInvalidParameter, "missing parent container ID", nil) return } - parentContainerRef, err := storagespace.ParseID(parentContainerID) + parentContainerID, err := storagespace.ParseID(parentContainerIDStr) if err != nil { writeError(w, r, appErrorInvalidParameter, "invalid parent container ID", nil) return @@ -155,7 +155,7 @@ func (s *svc) handleNew(w http.ResponseWriter, r *http.Request) { statParentContainerReq := &provider.StatRequest{ Ref: &provider.Reference{ - ResourceId: &parentContainerRef, + ResourceId: &parentContainerID, }, } parentContainer, err := client.Stat(ctx, statParentContainerReq) @@ -175,7 +175,8 @@ func (s *svc) handleNew(w http.ResponseWriter, r *http.Request) { } fileRef := &provider.Reference{ - Path: path.Join(parentContainer.Info.Path, utils.MakeRelativePath(filename)), + ResourceId: &parentContainerID, + Path: utils.MakeRelativePath(filename), } statFileReq := &provider.StatRequest{