Repository navigation
feat(browser-starfish): add relative image support in ui - #63680
Conversation
gggritso
left a comment
There was a problem hiding this comment.
👍🏻 if it's possible to concat the URL more safely it'd be a good idea!
| return ( | ||
| <ImageContainer | ||
| src={resource[SPAN_DESCRIPTION]} | ||
| src={new URL(src).toString()} |
There was a problem hiding this comment.
This can throw, we should account for error cases here
| src = url.href; | ||
| } catch { | ||
| Sentry.captureException(new Error('Invalid URL'), { | ||
| data: { |
There was a problem hiding this comment.
There's no data field able to be provided here, you probably want to set tags or contexts instead here.
There was a problem hiding this comment.
So strange, typescript said its available so I assumed that it would work, will update that in a PR soon!
| let src = resource[SPAN_DESCRIPTION]; | ||
| if (isRelativeUrl && hasRawDomain) { | ||
| try { | ||
| const url = new URL(resource[SPAN_DESCRIPTION], resource[RAW_DOMAIN]); |
There was a problem hiding this comment.
l: Can we extract this out to be a utility function?
There was a problem hiding this comment.
Hmm, what parts specifically, the whole try catch block? The try catch block + the isRelativeUrl && hasRawDomain logic?
There was a problem hiding this comment.
The try catch block + the isRelativeUrl && hasRawDomain logic.
Ideally with a func signature that looks like the following:
function getUrlFromSpanDescription(description: string | undefined, domain: string | undefined): string | undefined;but it's also l we dont have to come back and add this too.
There was a problem hiding this comment.
That's a good point, I can definitely see this being used elsewhere in the future.
…eption (#63978) @AbhiPrasad made a good point here, that we should be using the `tags` property instead of data when capturing exceptions #63680 (comment) This PR makes the appropriate changes

Once this getsentry/relay#2975 is merged and we update our JS SDK, we can grab the
raw_domainfield from spansIndexed in order to support the sample image view for relative urls.