Skip to content

Commit 782f2c5

Browse files
committed
🐛 fixing issue with regex for linkifying urls
1 parent 6ea7049 commit 782f2c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "barky",
3-
"version": "1.7.5",
3+
"version": "1.7.6",
44
"description": "A simple cloud services watchdog with digest notification support & no external dependencies",
55
"homepage": "https://github.com/Rohland/barky#readme",
66
"main": "dist/cli.js",

src/web/views/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ <h2 class="text-2xl font-semibold text-gray-800 dark:text-gray-100 mb-4">📣 Un
542542
}
543543

544544
function linkifyUrls(text) {
545-
const regex = /((https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,})(:\d+)?(\/[-a-z\d%_.~+&:]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?)/ig;
545+
const regex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.\S{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.\S{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.\S{2,}|www\.[a-zA-Z0-9]+\.\S{2,})/gi;
546546
return text.replace(regex, '<a href="$1" target="_blank">$1</a>');
547547
}
548548

0 commit comments

Comments
 (0)