fix: we need to pin the files after upload

This commit is contained in:
Derrick Hammer 2024-03-03 06:48:56 -05:00
parent d2c9f8e38a
commit 9d25784a6e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 0 deletions

View File

@ -1277,6 +1277,11 @@ func (s *S5API) processMultipartFiles(r *http.Request) (map[string]*metadata.Upl
return nil, NewS5Error(ErrKeyStorageOperationFailed, err)
}
err = s.accounts.PinByHash(upload.Hash, user)
if err != nil {
return nil, NewS5Error(ErrKeyStorageOperationFailed, err)
}
uploadMap[filename] = upload
}
}
@ -1343,6 +1348,11 @@ func (s *S5API) uploadAppMetadata(appData *s5libmetadata.WebAppMetadata, r *http
return "", NewS5Error(ErrKeyStorageOperationFailed, err)
}
err = s.accounts.PinByHash(upload.Hash, userId)
if err != nil {
return "", NewS5Error(ErrKeyStorageOperationFailed, err)
}
// Construct the CID for the newly uploaded s5libmetadata
cid, err := encoding.CIDFromHash(upload.Hash, uint64(len(appDataRaw)), types.CIDTypeMetadataWebapp, types.HashTypeBlake3)
if err != nil {