[@astrojs/image] remote images with protocol-relative URLs fail to fetch on build #4925
Closed
1 task done
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
pkg: image
Related to the `@astrojs/image` package (scope)
What version of
astro
are you using?1.4.0
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm
What operating system are you using?
Linux
Describe the Bug
When a remote image with a protocol-relative URL (starting with
//
) is passed to@astrojs/image
, it works in development, but on build it throwsimage could not be fetched
. This issue occurred due to Contentful returning this type of URL for assets.This could probably be fixed by checking for protocol-relative URLs and replacing them with https ones.
In the meantime, the following is a decent solution:
Note about reproduction: it appears that when using Stackblitz, remote images not using https don't work at all, so it may be best for the reproduction to be opened locally (Stackblitz has a download button).
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-drwgkz?file=src/pages/index.astro
Participation
The text was updated successfully, but these errors were encountered: