Skip to content

Commit

Permalink
Change format of ocm share file ids to <ocmstorageproviderid>$<sharei…
Browse files Browse the repository at this point in the history
…d>!<opaqueid>
  • Loading branch information
aduffeck committed Nov 20, 2023
1 parent 1e531ea commit 9701531
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/ocm/storage/received/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package ocm
import (
"context"
"encoding/xml"
"fmt"
"io"
"io/fs"
"net/http"
Expand Down Expand Up @@ -212,15 +213,22 @@ func convertStatToResourceInfo(ref *provider.Reference, f fs.FileInfo, share *oc
name = f.Name()
}

id, err := storagespace.ParseID(props.GetString(xml.Name{Space: "http://owncloud.org/ns", Local: "fileid"}))
remoteId, err := storagespace.ParseID(props.GetString(xml.Name{Space: "http://owncloud.org/ns", Local: "fileid"}))
if err != nil {
return nil, err
}

// ids are of the format <ocmstorageproviderid>$<shareid>!<opaqueid>
id := &provider.ResourceId{
StorageId: utils.OCMStorageProviderID,
SpaceId: share.Id.OpaqueId,
OpaqueId: fmt.Sprintf("%s:%s:%s", remoteId.StorageId, remoteId.SpaceId, remoteId.OpaqueId),
}
webdavProtocol, _ := getWebDAVProtocol(share.Protocols)

return &provider.ResourceInfo{
Type: t,
Id: &id,
Id: id,
MimeType: mime.Detect(f.IsDir(), f.Name()),
Path: name,
Name: name,
Expand Down

0 comments on commit 9701531

Please sign in to comment.