Skip to content

Commit

Permalink
fix creating new files with wopi (#2869)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christofas authored May 13, 2022
1 parent ea26f07 commit 587be61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-wopi-new-file.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions internal/http/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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{
Expand Down

0 comments on commit 587be61

Please sign in to comment.