diff --git a/api/s5/s5.go b/api/s5/s5.go index 4c14152..9753357 100644 --- a/api/s5/s5.go +++ b/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 {