diff --git a/__tests__/asset-proxy.ts b/__tests__/asset-proxy.ts index 64b60c1a..71888d35 100644 --- a/__tests__/asset-proxy.ts +++ b/__tests__/asset-proxy.ts @@ -28,7 +28,7 @@ test('request to https://asset-proxy.serlo.org/src?url=* gets asset from url que const env = currentTestEnvironment() const response = await env.fetch({ subdomain: 'asset-proxy', - pathname: `/src?url=${encodeURIComponent('https://whatever.org/image')}`, + pathname: '/src?url=https://whatever.org/image', }) expect(response.status).toBe(200) expect(response.headers.get('content-type')).toBe('image/png') diff --git a/src/asset-proxy.ts b/src/asset-proxy.ts index 400b4353..a712e7ba 100644 --- a/src/asset-proxy.ts +++ b/src/asset-proxy.ts @@ -18,12 +18,9 @@ export async function assetProxy(request: Request): Promise { return getPlaceholder() } - const originalResponse = await fetch( - encodeURIComponent(assetUrl.toString()), - { - cf: { cacheTtl: 24 * 60 * 60 }, - }, - ) + const originalResponse = await fetch(assetUrl, { + cf: { cacheTtl: 24 * 60 * 60 }, + }) if (originalResponse.ok && isImageResponse(originalResponse)) { const response = new Response(originalResponse.body, originalResponse)