1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00

fix: Secure S3 attachments, bump SDK, refactoring

Closes #673
This commit is contained in:
Maksim Eltyshev 2024-11-12 15:58:22 +01:00
parent f20a3d50f5
commit 97f4c0ab0d
27 changed files with 2180 additions and 702 deletions

View file

@ -26,17 +26,6 @@ module.exports = {
type: 'string',
required: true,
},
type: {
type: 'string',
},
url: {
type: 'string',
allowNull: true,
},
thumb: {
type: 'string',
allowNull: true,
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
@ -59,20 +48,12 @@ module.exports = {
},
customToJSON() {
let { url, thumb } = this;
if (!url) {
url = `${sails.config.custom.attachmentsUrl}/${this.id}/download/${this.filename}`;
}
if (!thumb) {
thumb = this.image
? `${sails.config.custom.attachmentsUrl}/${this.id}/download/thumbnails/cover-256.${this.image.thumbnailsExtension}`
: null;
}
return {
..._.omit(this, ['type', 'dirname', 'filename', 'image.thumbnailsExtension']),
url,
coverUrl: thumb,
..._.omit(this, ['dirname', 'filename', 'image.thumbnailsExtension']),
url: `${sails.config.custom.baseUrl}/attachments/${this.id}/download/${this.filename}`,
coverUrl: this.image
? `${sails.config.custom.baseUrl}/attachments/${this.id}/download/thumbnails/cover-256.${this.image.thumbnailsExtension}`
: null,
};
},
};