Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion oxlint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ const config = defineConfig({
'@tanstack/query/no-void-query-fn': 'error',
'@tanstack/query/mutation-property-order': 'error',
'react/capitalized-calls': 'error',
'react/error-boundaries': 'off', // TODO(ryan953): Fix violations and promote this warning to an error.
'react/error-boundaries': 'error',
'react/exhaustive-effect-dependencies': 'off', // TODO(ryan953): Fix violations and promote this warning to an error.
'react/function-component-definition': 'error',
'react/globals': 'off', // TODO(ryan953): Fix violations and promote this warning to an error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from 'sentry/icons';
import type {SVGIconProps} from 'sentry/icons/svgIcon';
import {isSafeHref} from 'sentry/utils/marked/marked';
import {safeURL} from 'sentry/utils/url/safeURL';

/**
* Every data type Seer surfaces as a resource link
Expand Down Expand Up @@ -82,23 +83,22 @@ export function ResourceLink({
);

if (/^https?:\/\//.test(href) && isSafeHref(href)) {
try {
const parsed = new URL(href);
if (parsed.origin !== window.location.origin) {
return (
<ExternalLink href={href}>
{icon} {title}
</ExternalLink>
);
}
const parsed = safeURL(href);
if (!parsed) {
return null;
}
if (parsed.origin !== window.location.origin) {
return (
<Link to={parsed.pathname + parsed.search + parsed.hash}>
<ExternalLink href={href}>
{icon} {title}
</Link>
</ExternalLink>
);
} catch {
return null;
}
return (
<Link to={parsed.pathname + parsed.search + parsed.hash}>
{icon} {title}
</Link>
);
}

if (/^\/[^/]/.test(href)) {
Expand Down
Loading