diff --git a/src/runtime/providers/bunny.ts b/src/runtime/providers/bunny.ts index 62e1f2e9b..69d228bc3 100644 --- a/src/runtime/providers/bunny.ts +++ b/src/runtime/providers/bunny.ts @@ -1,4 +1,4 @@ -import { joinURL } from 'ufo' +import { withBase, withQuery, getQuery } from 'ufo' import { createOperationsGenerator } from '../utils/index' import { defineProvider } from '../utils/provider' @@ -32,7 +32,7 @@ export default defineProvider({ getImage: (src, { modifiers, baseURL }) => { const operations = operationsGenerator(modifiers) return { - url: joinURL(baseURL, src + (operations ? '?' + operations : '')), + url: withQuery(withBase(src, baseURL), getQuery('?' + operations)), } }, }) diff --git a/test/e2e/__snapshots__/bunny.json5 b/test/e2e/__snapshots__/bunny.json5 index 48e639af2..dd21a529c 100644 --- a/test/e2e/__snapshots__/bunny.json5 +++ b/test/e2e/__snapshots__/bunny.json5 @@ -1,12 +1,12 @@ { "requests": [ - "https://bunnyoptimizerdemo.b-cdn.net/bunny1.jpg?sharpen=true&aspect_ratio=16%3A9&width=1000&quality=80", - "https://bunnyoptimizerdemo.b-cdn.net/bunny2.jpg?crop=750%2C750&crop_gravity=north", + "https://bunnyoptimizerdemo.b-cdn.net/bunny1.jpg?sharpen=true&aspect_ratio=16:9&width=1000&quality=80", + "https://bunnyoptimizerdemo.b-cdn.net/bunny2.jpg?crop=750,750&crop_gravity=north", "https://bunnyoptimizerdemo.b-cdn.net/bunny3.jpg?flop=true&auto_optimize=high", ], "sources": [ - "https://bunnyoptimizerdemo.b-cdn.net/bunny1.jpg?sharpen=true&aspect_ratio=16%3A9&width=1000&quality=80", - "https://bunnyoptimizerdemo.b-cdn.net/bunny2.jpg?crop=750%2C750&crop_gravity=north", + "https://bunnyoptimizerdemo.b-cdn.net/bunny1.jpg?sharpen=true&aspect_ratio=16:9&width=1000&quality=80", + "https://bunnyoptimizerdemo.b-cdn.net/bunny2.jpg?crop=750,750&crop_gravity=north", "https://bunnyoptimizerdemo.b-cdn.net/bunny3.jpg?flop=true&auto_optimize=high", ], } \ No newline at end of file