summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-04-06 23:03:25 +0000
committerTor Andersson <tor@ccxvii.net>2022-04-15 14:34:17 +0200
commitdadc4ca510d5e45e270faa04775f377d8ff40412 (patch)
tree56400c1ffd28294a1bfdc6a6e45844d07cd210ae /server.js
parent9b5f4346d31e82dc02763126d5c249cbfebb1e55 (diff)
downloadserver-dadc4ca510d5e45e270faa04775f377d8ff40412.tar.gz
Linkify all links in a post.
Diffstat (limited to 'server.js')
-rw-r--r--server.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/server.js b/server.js
index 4354d52..8b2a31d 100644
--- a/server.js
+++ b/server.js
@@ -742,7 +742,7 @@ function show_forum_page(req, res, page) {
function linkify_post(text) {
text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
- text = text.replace(/https?:\/\/\S+/, (match) => {
+ text = text.replace(/https?:\/\/\S+/g, (match) => {
if (match.endsWith(".jpg") || match.endsWith(".png") || match.endsWith(".svg"))
return `<a href="${match}"><img src="${match}"></a>`;
return `<a href="${match}">${match}</a>`;