handle resource ids better

This commit is contained in:
Michael Barz committed 2022-05-02 09:53:50 +02:00
1 parent a86cc5ab3a
commit 78a6af3af5
2 files changed
+7 -3

No files matched your search

+6 -3
View File
@@ -273,7 +273,8 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
identifierParts := strings.Split(driveID, "!")
switch len(identifierParts) {
case 1:
root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[0]
sID, _ := resourceid.StorageIDUnwrap(identifierParts[0])
root.StorageId, root.OpaqueId = identifierParts[0], sID
case 2:
root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[1]
default:
@@ -492,7 +493,8 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
}
spaceID := space.Root.StorageId
if space.Root.OpaqueId != space.Root.StorageId {
sIDs := resourceid.OwnCloudResourceIDUnwrap(rootID)
if space.Root.OpaqueId != sIDs.OpaqueId {
spaceID = rootID
}
drive := &libregraph.Drive{
@@ -735,9 +737,10 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) {
root := &storageprovider.ResourceId{}
identifierParts := strings.Split(driveID, "!")
sID, _ := resourceid.StorageIDUnwrap(identifierParts[0])
switch len(identifierParts) {
case 1:
root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[0]
root.StorageId, root.OpaqueId = identifierParts[0], sID
case 2:
root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[1]
default:
+1
View File
@@ -274,3 +274,4 @@ require (
// we need to use a fork to make the windows build pass
replace github.com/pkg/xattr => github.com/micbar/xattr v0.4.6-0.20220215112335-88e74d648fb7
replace github.com/cs3org/reva/v2 => ../reva