Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix details tab log url detection #42104

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export const parseLogs = (
const ansiUp = new AnsiUp();
ansiUp.url_allowlist = {};

const urlRegex = /((https?:\/\/|http:\/\/)(?:(?!'|")[^\s])+)/g;
const urlRegex =
/http(s)?:\/\/[\w.-]+(\.?:[\w.-]+)*([/?#][\w\-._~:/?#[\]@!$&'()*+,;=.%]+)?/g;
// Coloring (blue-60 as chakra style, is #0060df) and style such that log group appears like a link
const logGroupStyle = "color:#0060df;cursor:pointer;font-weight:bold;";

Expand Down Expand Up @@ -137,7 +138,8 @@ export const parseLogs = (
const lineWithHyperlinks = coloredLine
.replace(
urlRegex,
'<a href="$1" target="_blank" rel="noopener noreferrer" style="color: blue; text-decoration: underline;">$1</a>'
(url) =>
`<a href="${url}" target="_blank" rel="noopener noreferrer" style="color: blue; text-decoration: underline;">${url}</a>`
)
.replace(logGroupStart, (textLine) => {
const unfoldIdSuffix = "_unfold";
Expand Down
Loading