fix: we need to pin the files after upload
This commit is contained in:
parent
d2c9f8e38a
commit
9d25784a6e
10
api/s5/s5.go
10
api/s5/s5.go
|
@ -1277,6 +1277,11 @@ func (s *S5API) processMultipartFiles(r *http.Request) (map[string]*metadata.Upl
|
||||||
return nil, NewS5Error(ErrKeyStorageOperationFailed, err)
|
return nil, NewS5Error(ErrKeyStorageOperationFailed, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = s.accounts.PinByHash(upload.Hash, user)
|
||||||
|
if err != nil {
|
||||||
|
return nil, NewS5Error(ErrKeyStorageOperationFailed, err)
|
||||||
|
}
|
||||||
|
|
||||||
uploadMap[filename] = upload
|
uploadMap[filename] = upload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1343,6 +1348,11 @@ func (s *S5API) uploadAppMetadata(appData *s5libmetadata.WebAppMetadata, r *http
|
||||||
return "", NewS5Error(ErrKeyStorageOperationFailed, err)
|
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
|
// Construct the CID for the newly uploaded s5libmetadata
|
||||||
cid, err := encoding.CIDFromHash(upload.Hash, uint64(len(appDataRaw)), types.CIDTypeMetadataWebapp, types.HashTypeBlake3)
|
cid, err := encoding.CIDFromHash(upload.Hash, uint64(len(appDataRaw)), types.CIDTypeMetadataWebapp, types.HashTypeBlake3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue