mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-26 18:44:56 +03:00
encrypted-bucket: delete
This commit is contained in:
parent
99aa58f3f5
commit
12c04b4358
@ -1,8 +1,6 @@
|
||||
import { dispatchCustomEvent } from "~/common/custom-events";
|
||||
|
||||
export const upload = async ({ file, context, bucketName }) => {
|
||||
console.log({ bucketName });
|
||||
|
||||
let formData = new FormData();
|
||||
const HEIC2ANY = require("heic2any");
|
||||
|
||||
|
@ -51,6 +51,7 @@ export default async (req, res) => {
|
||||
// Would be nice to be nice to get `entity.encrypted` on the bucket property.
|
||||
let items = null;
|
||||
if (bucketName === "encrypted-deal") {
|
||||
console.log("[ encrypted ] archiving encrypted bucket");
|
||||
try {
|
||||
const path = await buckets.listPath(bucketRoot.key, "/");
|
||||
items = path.item;
|
||||
|
@ -62,18 +62,36 @@ export default async (req, res) => {
|
||||
.send({ decorator: "SERVER_BUCKET_NOT_FOUND", error: true });
|
||||
}
|
||||
|
||||
// TODO(jim): Put this call into a file for all Textile related calls.
|
||||
// TODO(sander+jim):
|
||||
// See line: 196 on https://github.com/filecoin-project/slate/blob/main/node_common/managers/viewer.js
|
||||
// Would be nice to be nice to get `entity.encrypted` on the bucket property.
|
||||
let items = null;
|
||||
try {
|
||||
items = await buckets.listIpfsPath(targetBucket.path);
|
||||
} catch (e) {
|
||||
Social.sendTextileSlackMessage({
|
||||
file: "/pages/api/data/bucket-remove.js",
|
||||
user,
|
||||
message: e.message,
|
||||
code: e.code,
|
||||
functionName: `buckets.listIpfsPath`,
|
||||
});
|
||||
if (targetBucket.name === "encrypted-deal") {
|
||||
console.log("[ encrypted ] removing from encrypted bucket");
|
||||
try {
|
||||
const path = await buckets.listPath(targetBucket.key, "/");
|
||||
items = path.item;
|
||||
} catch (e) {
|
||||
Social.sendTextileSlackMessage({
|
||||
file: "/pages/api/data/bucket-remove.js",
|
||||
user,
|
||||
message: e.message,
|
||||
code: e.code,
|
||||
functionName: `buckets.listPath`,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
items = await buckets.listIpfsPath(targetBucket.path);
|
||||
} catch (e) {
|
||||
Social.sendTextileSlackMessage({
|
||||
file: "/pages/api/data/bucket-remove.js",
|
||||
user,
|
||||
message: e.message,
|
||||
code: e.code,
|
||||
functionName: `buckets.listIpfsPath`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!items) {
|
||||
|
Loading…
Reference in New Issue
Block a user