fix webdav URL of drive roots in graph API

This commit is contained in:
David Christofas
2022-06-02 14:09:03 +02:00
parent 6cde9c5405
commit 4470c045ed
3 changed files with 13 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
Bugfix: Fix the webdav URL of drive roots
Fixed the webdav URL of drive roots in the graph API.
https://github.com/owncloud/ocis/issues/3706
https://github.com/owncloud/ocis/pull/3916

View File

@@ -7,6 +7,7 @@ import (
"math"
"net/http"
"net/url"
"path"
"sort"
"strconv"
"strings"
@@ -581,8 +582,9 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
// TODO read from StorageSpace ... needs Opaque for now
// TODO how do we build the url?
// for now: read from request
webDavURL := baseURL.String() + spaceID
drive.Root.WebDavUrl = &webDavURL
webDavURL := *baseURL
webDavURL.Path = path.Join(webDavURL.Path, spaceID)
drive.Root.WebDavUrl = libregraph.PtrString(webDavURL.String())
}
// TODO The public space has no owner ... should we even show it?

View File

@@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/http/httptest"
"net/url"
"time"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
@@ -245,11 +246,12 @@ var _ = Describe("Graph", func() {
Expect(err).ToNot(HaveOccurred())
Expect(len(response["value"])).To(Equal(1))
value := response["value"][0]
webdavURL, _ := url.PathUnescape(*value.Root.WebDavUrl)
Expect(*value.DriveAlias).To(Equal("mountpoint/new-folder"))
Expect(*value.DriveType).To(Equal("mountpoint"))
Expect(*value.Id).To(Equal("prID$aID!differentID"))
Expect(*value.Name).To(Equal("New Folder"))
Expect(*value.Root.WebDavUrl).To(Equal("https://localhost:9200/dav/spaces/prID$aID!differentID"))
Expect(webdavURL).To(Equal("https://localhost:9200/dav/spaces/prID$aID!differentID"))
Expect(*value.Root.ETag).To(Equal("101112131415"))
Expect(*value.Root.Id).To(Equal("prID$aID!differentID"))
Expect(*value.Root.RemoteItem.ETag).To(Equal("123456789"))