From c2e3879c1fb4363f46a5284779c4bc9e80c7ccdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Touati?= Date: Sun, 8 Dec 2024 19:44:43 +0100 Subject: [PATCH] fix: fix ansi link color + regex (#3440) --- assets/components/LogViewer/LogItem.vue | 5 ---- assets/components/LogViewer/SimpleLogItem.vue | 9 +++++- .../__snapshots__/EventSource.spec.ts.snap | 30 +++++++++---------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/assets/components/LogViewer/LogItem.vue b/assets/components/LogViewer/LogItem.vue index 781de69b..aab49111 100644 --- a/assets/components/LogViewer/LogItem.vue +++ b/assets/components/LogViewer/LogItem.vue @@ -26,8 +26,3 @@ const { hosts } = useHosts(); const container = currentContainer(toRef(() => logEntry.containerID)); const host = computed(() => hosts.value[container.value.host]); - diff --git a/assets/components/LogViewer/SimpleLogItem.vue b/assets/components/LogViewer/SimpleLogItem.vue index a7e19c6c..8dc3c22c 100644 --- a/assets/components/LogViewer/SimpleLogItem.vue +++ b/assets/components/LogViewer/SimpleLogItem.vue @@ -28,7 +28,14 @@ defineProps<{ }>(); const colorize = (value: string) => ansiConvertor.toHtml(value); -const urlPattern = /(https?:\/\/[^\s]+)/g; +const urlPattern = + /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_+.~#?&\/=]*/g; const linkify = (text: string) => text.replace(urlPattern, (url) => `${url}`); + + diff --git a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap index 4afebbac..5dfbd404 100644 --- a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap +++ b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap @@ -3,16 +3,16 @@ exports[` > render html correctly > should render dates with 12 hour style 1`] = ` "