mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
support project background + user avatar
This commit is contained in:
parent
84b0f91b44
commit
e84a2837ab
13 changed files with 223 additions and 46 deletions
|
@ -86,6 +86,21 @@ module.exports = {
|
|||
(!project.backgroundImage ||
|
||||
project.backgroundImage.dirname !== inputs.record.backgroundImage.dirname)
|
||||
) {
|
||||
try {
|
||||
if (sails.config.custom.s3Config) {
|
||||
const client = await sails.helpers.utils.getSimpleStorageServiceClient();
|
||||
if (client && inputs.record.backgroundImage && inputs.record.backgroundImage.original) {
|
||||
const parsedUrl = new URL(inputs.record.backgroundImage.original);
|
||||
await client.delete({ Key: parsedUrl.pathname.replace(/^\/+/, '') });
|
||||
}
|
||||
if (client && inputs.record.backgroundImage && inputs.record.backgroundImage.thumb) {
|
||||
const parsedUrl = new URL(inputs.record.backgroundImage.thumb);
|
||||
await client.delete({ Key: parsedUrl.pathname.replace(/^\/+/, '') });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error.stack); // eslint-disable-line no-console
|
||||
}
|
||||
try {
|
||||
rimraf.sync(
|
||||
path.join(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue