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

Handle links to other domains in Featured Section urls #1827

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

chigby
Copy link
Contributor

@chigby chigby commented Jan 26, 2024

Before this, if a featured section in a report was configured with a URL that pointed to an outside domain (one different from location.origin), the link would fail when clicked because it uses the Link component from react router, which we've set up to work only with relative link paths.

I've changed it so that we check the link and if it's to another domain (using the pre-existing logic for checking that), and if so, we render a normal <a> tag that will not interact with react router at all. If it is a relative link, then it will use the react router Link component as before.

Before this, if a featured section in a report was configured with a
URL that pointed to an outside domain (one different from
`location.origin`), the link would fail when clicked because it uses
the `Link` component from react router, which we've set up to work
only with relative link paths.

I've changed it so that we check the link and if it's to another
domain (using the pre-existing logic for checking that), and if so, we
render a normal `<a>` tag that will not interact with react router at
all.  If it _is_ a relative link, then it will use the react router
`Link` component as before.
@nmorduch nmorduch merged commit d992773 into main Feb 2, 2024
1 check passed
@nmorduch nmorduch deleted the report-featured-section-external-links branch February 2, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants