From 3b6c876ddfe4315a88f891cec24b7714f7e4fdbf Mon Sep 17 00:00:00 2001 From: Wei GENG Date: Wed, 26 Feb 2025 13:10:31 +0100 Subject: [PATCH 1/2] Update README.md fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1f06e8..e5a7db4 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ npm install --save @raycast/utils ## Documentation -Find the documentation on [developers.raycast.com](https://developers.raycast.com/utils-reference). +Find the documentation on [developers.raycast.com](https://developers.raycast.com/utilities/getting-started). From 21a29b6c350991836810076d370e7ccabccad954 Mon Sep 17 00:00:00 2001 From: Wei Geng Date: Sat, 1 Mar 2025 01:08:14 +0100 Subject: [PATCH 2/2] minor fix --- src/icon/favicon.ts | 12 +++++++++++- tests/src/favicon.tsx | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/icon/favicon.ts b/src/icon/favicon.ts index 133fcb6..f2c73fa 100644 --- a/src/icon/favicon.ts +++ b/src/icon/favicon.ts @@ -34,8 +34,18 @@ export function getFavicon( mask?: Image.Mask; }, ): Image.ImageLike { + // a func adding https:// to the URL + // for cases where the URL is not a full URL + // e.g. "raycast.com" + const withHttps = (url: string) => { + if (!url.startsWith("http")) { + return `https://${url}`; + } + return url; + }; + try { - const urlObj = typeof url === "string" ? new URL(url) : url; + const urlObj = typeof url === "string" ? new URL(withHttps(url)) : url; const hostname = urlObj.hostname; return { source: `https://www.google.com/s2/favicons?sz=${options?.size ?? 64}&domain=${hostname}`, diff --git a/tests/src/favicon.tsx b/tests/src/favicon.tsx index 2828aab..4a1f604 100644 --- a/tests/src/favicon.tsx +++ b/tests/src/favicon.tsx @@ -5,6 +5,7 @@ export default function Command() { return ( + ); }