Skip to content

Commit

Permalink
Enable asset url not to start by https://
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Nov 3, 2023
1 parent c8fd11a commit e15ef07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tools/LazySvg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ export const createLazySvg = memoize((svgUrl: string) => {

const svgUrlToSvgComponent = memoize(
async (svgUrl: string) => {
const rawSvgString = await fetch(svgUrl)
const rawSvgString = await fetch(
svgUrl.startsWith("http") || svgUrl.startsWith("/")
? svgUrl
: `https://${svgUrl}`,
)
.then(response => response.text())
.catch(() => undefined);

Expand Down

0 comments on commit e15ef07

Please sign in to comment.