mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 11:26:31 +00:00
Skip data: images for image resizing (#248)
This commit is contained in:
@@ -44,6 +44,13 @@ export async function getResizedImageURL(
|
||||
): Promise<
|
||||
(options: { width?: number; height?: number; dpr?: number; quality?: number }) => string
|
||||
> {
|
||||
// Skip it for non-http(s) URLs (data, etc).
|
||||
const protocol = URL.canParse(input) ? new URL(input).protocol : '';
|
||||
if (protocol !== 'http:' && protocol !== 'https:') {
|
||||
return () => input;
|
||||
}
|
||||
|
||||
|
||||
const signature = await generateSignature(input);
|
||||
if (!signature) {
|
||||
return () => input;
|
||||
|
||||
Reference in New Issue
Block a user