mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-03 12:10:34 +00:00
Use absolute URLs for logos (#161)
This commit is contained in:
@@ -102,11 +102,11 @@ function LogoFallback(props: HeaderLogoProps) {
|
||||
}
|
||||
: {
|
||||
light: {
|
||||
src: absoluteHref('~gitbook/icon?size=medium&theme=light'),
|
||||
src: absoluteHref('~gitbook/icon?size=medium&theme=light', true),
|
||||
size: { width: 256, height: 256 },
|
||||
},
|
||||
dark: {
|
||||
src: absoluteHref('~gitbook/icon?size=medium&theme=dark'),
|
||||
src: absoluteHref('~gitbook/icon?size=medium&theme=dark', true),
|
||||
size: { width: 256, height: 256 },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -122,6 +122,15 @@ export async function resizeImage(
|
||||
): Promise<Response> {
|
||||
const { signal, ...resizeOptions } = options;
|
||||
|
||||
const parsed = new URL(input);
|
||||
if (parsed.protocol === 'data:') {
|
||||
throw new Error('Cannot resize data: URLs');
|
||||
}
|
||||
|
||||
if (parsed.hostname === 'localhost') {
|
||||
throw new Error('Cannot resize localhost URLs');
|
||||
}
|
||||
|
||||
// Since Cloudflare Images options on fetch are not supported on Cloudflare Pages,
|
||||
// we need to use the Cloudflare Image Resize API directly.
|
||||
if (process.env.GITBOOK_IMAGE_RESIZE_URL) {
|
||||
|
||||
Reference in New Issue
Block a user