feat: add support for directories in GetMetadataByCID
This commit is contained in:
parent
712e216150
commit
f6e005c497
|
@ -17,6 +17,10 @@ type DirectoryMetadata struct {
|
|||
|
||||
var _ SerializableMetadata = (*DirectoryMetadata)(nil)
|
||||
|
||||
func NewEmptyDirectoryMetadata() *DirectoryMetadata {
|
||||
return &DirectoryMetadata{}
|
||||
}
|
||||
|
||||
func NewDirectoryMetadata(details DirectoryMetadataDetails, directories directoryReferenceMap, files fileReferenceMap, extraMetadata ExtraMetadata) *DirectoryMetadata {
|
||||
dirMetadata := &DirectoryMetadata{
|
||||
Details: details,
|
||||
|
|
|
@ -306,6 +306,13 @@ func (n *NodeImpl) GetMetadataByCID(cid *encoding.CID) (md metadata.Metadata, er
|
|||
case types.CIDTypeMetadataWebapp:
|
||||
md = metadata.NewEmptyWebAppMetadata()
|
||||
|
||||
err = msgpack.Unmarshal(bytes, md)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case types.CIDTypeDirectory:
|
||||
md = metadata.NewEmptyDirectoryMetadata()
|
||||
|
||||
err = msgpack.Unmarshal(bytes, md)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue