Skip to content

Commit

Permalink
fix(web): removing referrer header when clicking on links. Fixes #387 (
Browse files Browse the repository at this point in the history
…#388)

added "noreferrer" to the links to prevent sending referrers to bookmarked pages
  • Loading branch information
kamtschatka authored Sep 14, 2024
1 parent 095995d commit 3b8cebb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/web/components/dashboard/bookmarks/LinkCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function LinkTitle({ bookmark }: { bookmark: ZBookmarkTypeLink }) {
const link = bookmark.content;
const parsedUrl = new URL(link.url);
return (
<Link href={link.url} target="_blank">
<Link href={link.url} target="_blank" rel="noreferrer">
{bookmark.title ?? link?.title ?? parsedUrl.host}
</Link>
);
Expand All @@ -42,7 +42,7 @@ function LinkImage({

const imageDetails = getBookmarkLinkImageUrl(link);

let img: React.ReactNode = null;
let img: React.ReactNode;
if (isBookmarkStillCrawling(bookmark)) {
img = imgComponent("/blur.avif", false);
} else if (imageDetails) {
Expand All @@ -57,7 +57,12 @@ function LinkImage({
}

return (
<Link href={link.url} target="_blank" className={className}>
<Link
href={link.url}
target="_blank"
rel="noreferrer"
className={className}
>
<div className="relative size-full flex-1">{img}</div>
</Link>
);
Expand All @@ -71,6 +76,7 @@ function LinkUrl({ bookmark }: { bookmark: ZBookmarkTypeLink }) {
className="line-clamp-1 hover:text-foreground"
href={link.url}
target="_blank"
rel="noreferrer"
>
{parsedUrl.host}
</Link>
Expand Down

0 comments on commit 3b8cebb

Please sign in to comment.