Hot fix delete file
This commit is contained in:
parent
3bdeb683da
commit
399f98ea72
@ -49,6 +49,7 @@ export default class FilesService extends BaseService {
|
|||||||
*/
|
*/
|
||||||
public async delete(uid: string) {
|
public async delete(uid: string) {
|
||||||
const fileToUnpin = await this.filesRepository.findOneByUid(uid);
|
const fileToUnpin = await this.filesRepository.findOneByUid(uid);
|
||||||
|
if(!fileToUnpin) throw new Error("File not found");
|
||||||
const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv);
|
const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv);
|
||||||
const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length);
|
const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length);
|
||||||
await this.ipfsService.unpinFile(fileHash)
|
await this.ipfsService.unpinFile(fileHash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user