Skip to content

Commit de473d2

Browse files
authored
fix(cloudflare): add baseURL for urls with no operations (#2162)
1 parent 403b109 commit de473d2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/runtime/providers/cloudflare.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { encodeQueryItem, joinURL } from 'ufo'
1+
import { encodeQueryItem, hasProtocol, joinURL } from 'ufo'
22
import { createOperationsGenerator } from '../utils/index'
33
import { defineProvider } from '../utils/provider'
44

@@ -46,7 +46,7 @@ export default defineProvider<CloudflareOptions>({
4646
const operations = operationsGenerator(mergeModifiers as any)
4747

4848
// https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>
49-
const url = operations ? joinURL(baseURL, 'cdn-cgi/image', operations, src) : src
49+
const url = operations ? joinURL(baseURL, 'cdn-cgi/image', operations, src) : hasProtocol(src) ? src : joinURL(baseURL, src)
5050

5151
return {
5252
url,

0 commit comments

Comments
 (0)