chore: merge branch dev to main #195

Merged
Anri merged 18 commits from dev into main 2024-10-14 23:41:43 +02:00
Showing only changes of commit f47d62faad - Show all commits

View file

@ -12,8 +12,8 @@ export const handleAttachments = (
} else {
// Contains more than one image and/or other files
// We are currently losing a link to a file if the link is too long,
// but we can't do much about it
// We are currently losing a link to a file if the link is too long
// We could truncate the filename ?
const maxFieldValueLength = 1024;
const files = attachments
.map((file) => `[${file.name}](${file.url})`)
@ -25,8 +25,7 @@ export const handleAttachments = (
files.forEach((file, idx) => {
const fieldValue = currentField.length > 0 ? `${currentField}, ${file}` : file;
// TODO: There is a bug when there is ONE field, it crashes
if (fieldValue.length > maxFieldValueLength || idx === files.length - 1) {
if (fieldValue.length > maxFieldValueLength) {
multiple = multiple === 0 && idx !== files.length - 1 ? 1 : multiple + 1;
fields.push({
name:
@ -41,6 +40,15 @@ export const handleAttachments = (
}
});
if (currentField.length > 0) {
fields.push({
name:
loc.get(attachments.size > 1 && multiple ? "e_attachements" : "e_attachement") +
(multiple ? ` (${multiple + 1})` : ""),
value: currentField,
});
}
embed.addFields(fields);
}
};