diff --git a/web/index.php b/web/index.php
index 0ffe376..7b979df 100644
--- a/web/index.php
+++ b/web/index.php
@@ -91,10 +91,14 @@ function showToast(msg, type = 'success') {
function buildTransferDropdown(sourceId, currentUsername) {
const others = ALL_ACCOUNTS.filter(a => a.username !== currentUsername);
- if (!others.length) return '';
+ if (!others.length) {
+ return ``;
+ }
const items = others.map(a =>
`
@@ -151,11 +155,12 @@ function renderMails(rows) {
});
let filesHtml = '
Aucune pièce jointe';
if (r.files_list && r.files_list.length) {
- filesHtml = r.files_list.map(f =>
- f.exists
- ? `
${escHtml(f.name.substring(0,22))}`
- : `
${escHtml(f.name.substring(0,22))}`
- ).join('');
+ filesHtml = r.files_list.map(f => {
+ const label = shortName(f.name);
+ return f.exists
+ ? `
${escHtml(label)}`
+ : `
⚠ ${escHtml(label)}`;
+ }).join('');
}
const transferBtn = buildTransferDropdown(r.id, r.username);
return `
@@ -181,6 +186,14 @@ function escHtml(s) {
return String(s).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');
}
+function shortName(name) {
+ const dot = name.lastIndexOf('.');
+ const ext = dot >= 0 ? name.substring(dot) : '';
+ const base = dot >= 0 ? name.substring(0, dot) : name;
+ if (name.length <= 24) return name;
+ return base.substring(0, 14) + '…' + ext;
+}
+
function loadMails() {
fetch('/api/mails.php')
.then(r => r.json())