@@ -9,7 +9,6 @@ import { getAssetURL } from '@/lib/assets';
9
9
import { filterOutNullable } from '@/lib/typescript' ;
10
10
import { getCacheTag } from '@gitbook/cache-tags' ;
11
11
import type { GitBookSiteContext } from '@v2/lib/context' ;
12
- import { getCloudflareContext } from '@v2/lib/data/cloudflare' ;
13
12
import { getResizedImageURL } from '@v2/lib/images' ;
14
13
15
14
const googleFontsMap : { [ fontName in CustomizationDefaultFont ] : string } = {
@@ -322,24 +321,6 @@ function logOnCloudflareOnly(message: string) {
322
321
}
323
322
}
324
323
325
- /**
326
- * Fetch a resource from the function itself.
327
- * To avoid error with worker to worker requests in the same zone, we use the `WORKER_SELF_REFERENCE` binding.
328
- */
329
- async function fetchSelf ( url : string ) {
330
- const cloudflare = getCloudflareContext ( ) ;
331
- if ( cloudflare ?. env . WORKER_SELF_REFERENCE ) {
332
- logOnCloudflareOnly ( `Fetching self: ${ url } ` ) ;
333
- return await cloudflare . env . WORKER_SELF_REFERENCE . fetch (
334
- // `getAssetURL` can return a relative URL, so we need to make it absolute
335
- // the URL doesn't matter, as we're using the worker-self-reference binding
336
- new URL ( url , 'https://worker-self-reference/' )
337
- ) ;
338
- }
339
-
340
- return await fetch ( url ) ;
341
- }
342
-
343
324
/**
344
325
* Read an image from a response as a base64 encoded string.
345
326
*/
@@ -377,7 +358,7 @@ async function readStaticImage(url: string) {
377
358
* Read an image from GitBook itself.
378
359
*/
379
360
async function readSelfImage ( url : string ) {
380
- const response = await fetchSelf ( url ) ;
361
+ const response = await fetch ( url ) ;
381
362
const image = await readImage ( response ) ;
382
363
return image ;
383
364
}
0 commit comments