From 3b8cebb8c88bd3d680b26000a7c90834aa511109 Mon Sep 17 00:00:00 2001
From: kamtschatka <simon.schatka@gmx.at>
Date: Sat, 14 Sep 2024 21:39:05 +0200
Subject: fix(web): removing referrer header when clicking on links. Fixes #387
 (#388)

added "noreferrer" to the links to prevent sending referrers to bookmarked pages
---
 apps/web/components/dashboard/bookmarks/LinkCard.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'apps/web/components/dashboard/bookmarks/LinkCard.tsx')

diff --git a/apps/web/components/dashboard/bookmarks/LinkCard.tsx b/apps/web/components/dashboard/bookmarks/LinkCard.tsx
index 7212940b..dc189b10 100644
--- a/apps/web/components/dashboard/bookmarks/LinkCard.tsx
+++ b/apps/web/components/dashboard/bookmarks/LinkCard.tsx
@@ -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>
   );
@@ -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) {
@@ -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>
   );
@@ -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>
-- 
cgit v1.2.3-70-g09d2

