Skip to content

Commit 4ec3af5

Browse files
committed
fix: bad mime type for attachments; do not adorn hilite text not at word boundaries
1 parent 57b75c5 commit 4ec3af5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

discord/ipcMessages/irc-channelJoined.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = async function (parsed, context) {
106106
if (hiList && Array.isArray(hiList) && hiList.some(x => e.message.match(new RegExp(`\\b(${x})\\b`, 'i')))) {
107107
if (config.user.markHilites) {
108108
for (const x of hiList) {
109-
e.message = e.message.replace(new RegExp(`\\b(${x})\\b`, 'i'), '**_$1_**');
109+
e.message = e.message.replace(new RegExp(`\b(${x})\b`, 'i'), '**_$1_**');
110110
}
111111
}
112112

http.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ redisListener.subscribe(PREFIX, (err) => {
7878

7979
try {
8080
console.log(`serving ${attachmentPath}`);
81-
return res.send(await fs.promises.readFile(attachmentPath));
81+
const mimeType = mimeTypes.lookup(path.parse(attachmentPath).ext || 'application/octet-stream');
82+
return res.type(mimeType).send(await fs.promises.readFile(attachmentPath));
8283
} catch (e) {
8384
console.error(`failed to send ${attachmentPath}:`, e);
8485
return res.redirect(config.http.rootRedirectUrl);

0 commit comments

Comments
 (0)