Skip to content

Commit

Permalink
fix(uploadcare): omit base when resolved URL is returned (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronLejeune committed Apr 22, 2024
1 parent d8e14ed commit d2a2c6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/providers/uploadcare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* - File Groups
*/

import { joinURL, withTrailingSlash } from 'ufo'
import { joinURL, hasProtocol, withTrailingSlash } from 'ufo'
import type { ProviderGetImage } from '../../types'
import { createOperationsGenerator } from '#image'

Expand Down Expand Up @@ -63,6 +63,7 @@ export const getImage: ProviderGetImage = (
}

const operations = operationsGenerator(modifiers)
const url = withTrailingSlash(joinURL(cdnURL || 'https://ucarecdn.com', uuid, operations))
const base = hasProtocol(uuid) ? '' : (cdnURL || 'https://ucarecdn.com')
const url = withTrailingSlash(joinURL(base, uuid, operations))
return { url }
}

0 comments on commit d2a2c6f

Please sign in to comment.