feat: add support for resolving a registry entry when pinning
This commit is contained in:
parent
b3df326980
commit
3f2757fb18
14
api/s5/s5.go
14
api/s5/s5.go
|
@ -904,6 +904,20 @@ func (s *S5API) accountPin(jc jape.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if decodedCid.Type == types.CIDTypeResolver {
|
||||
entry, err := s.getNode().Services().Registry().Get(decodedCid.Hash.FullBytes())
|
||||
if err != nil {
|
||||
s.sendErrorResponse(jc, NewS5Error(ErrKeyResourceNotFound, err))
|
||||
return
|
||||
}
|
||||
|
||||
decodedCid, err = encoding.CIDFromRegistry(entry.Data())
|
||||
if err != nil {
|
||||
s.sendErrorResponse(jc, NewS5Error(ErrKeyInternalError, err))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
found := true
|
||||
|
||||
if err := s.accounts.PinByHash(decodedCid.Hash.HashBytes(), userID); err != nil {
|
||||
|
|
Loading…
Reference in New Issue