diff options
| author | julian laplace <julescarbon@gmail.com> | 2026-03-27 15:14:43 +0100 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2026-03-27 15:14:43 +0100 |
| commit | d23c6dff28491333ff5ea092ad564f35390dc9a7 (patch) | |
| tree | 95a7c66daba43952c87cfb20dfbcc3c508e59e78 | |
| parent | e59842e76962c309bdbfc5c65bed2295f4bbf278 (diff) | |
fix body encoding
| -rw-r--r-- | bucky/app/bucky.js | 14 | ||||
| -rw-r--r-- | public/assets/js/lib/views/mail/message.js | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index 81171f4..3e76e9b 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -92,7 +92,7 @@ var bucky = (module.exports = { res.threads_ids = threads.pluck("id").sort(); res.keywords = _.uniq(threads.pluck("keyword")); next(); - }) + }), ); } else if (query.thread) { db.getThread(query.thread).then((thread) => @@ -110,7 +110,7 @@ var bucky = (module.exports = { res.threads_ids = [query.thread]; res.keywords = [thread.get("keyword")]; next(); - }) + }), ); } else { Promise.all([ @@ -413,7 +413,7 @@ var bucky = (module.exports = { res.sendStatus(404); } db.getTopThreadsForUser(username, limit, offset).then(function ( - top_threads + top_threads, ) { res.topThreads = top_threads; res.topThreads_ids = res.topThreads.pluck("id").sort(); @@ -794,7 +794,7 @@ var bucky = (module.exports = { req.user.get("username"), req.params.box, limit, - offset + offset, ).then(function (messages) { res.messages = messages; res.query = { limit, offset }; @@ -815,6 +815,12 @@ var bucky = (module.exports = { return; } res.message = message; + + // Fix mail body encoding ... + const body = res.message.get("body"); + if (body instanceof Buffer) { + res.message.set("body", body.toString("utf8")); + } next(); }); }, diff --git a/public/assets/js/lib/views/mail/message.js b/public/assets/js/lib/views/mail/message.js index 6ea2274..8ad6c1a 100644 --- a/public/assets/js/lib/views/mail/message.js +++ b/public/assets/js/lib/views/mail/message.js @@ -42,7 +42,7 @@ var MessageView = View.extend({ .replace(/{{subject}}/g, message.subject) .replace(/{{date}}/g, datetime[0]) .replace(/{{time}}/g, datetime[1]) - .replace(/{{body}}/g, tidy_urls(message.body)); + .replace(/{{body}}/g, tidy_urls(message.body || "")); var $t = $(t); if (is_sender) { $t.find(".reply_link").remove(); |
