mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
support attachments s3
This commit is contained in:
parent
f6ea10df97
commit
84b0f91b44
10 changed files with 392 additions and 14 deletions
|
@ -51,7 +51,18 @@ module.exports = {
|
|||
|
||||
if (attachment) {
|
||||
try {
|
||||
rimraf.sync(path.join(sails.config.custom.attachmentsPath, attachment.dirname));
|
||||
const type = attachment.type || 'local';
|
||||
if (type === 's3') {
|
||||
const client = await sails.helpers.attachments.getSimpleStorageServiceClient();
|
||||
if (client) {
|
||||
const file1 = `${attachment.dirname}/${attachment.filename}`;
|
||||
const file2 = `${attachment.dirname}/thumbnails/cover-256.png`;
|
||||
await client.delete({ Key: file1 });
|
||||
await client.delete({ Key: file2 });
|
||||
}
|
||||
} else {
|
||||
rimraf.sync(path.join(sails.config.custom.attachmentsPath, attachment.dirname));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error.stack); // eslint-disable-line no-console
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue