Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@astrojs/image]: Picture not working with query parameter #4996

Closed
1 task done
panwauu opened this issue Oct 6, 2022 · 1 comment · Fixed by #4997
Closed
1 task done

[@astrojs/image]: Picture not working with query parameter #4996

panwauu opened this issue Oct 6, 2022 · 1 comment · Fixed by #4997
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: image Related to the `@astrojs/image` package (scope)

Comments

@panwauu
Copy link
Contributor

panwauu commented Oct 6, 2022

What version of astro are you using?

1.4.4

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

When running build with a picture and a query parameter in src I get the following error:
Error: Expected one of: heic, heif, avif, jpeg, jpg, jpe, tile, dz, png, raw, tiff, tif, webp, gif, jp2, jpx, j2k, j2c for format but received jpg?test=test of type string

To determine the file extension the query parameter should be ignore. It works in dev.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-qnk2xr-4dvsmq?file=src%2Fpages%2Findex.astro&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the pkg: image Related to the `@astrojs/image` package (scope) label Oct 6, 2022
@tony-sull tony-sull self-assigned this Oct 6, 2022
@tony-sull tony-sull added - P4: important Violate documented behavior or significantly impacts performance (priority) s1-small labels Oct 6, 2022
@akyag
Copy link

akyag commented Oct 24, 2022

Same error when importing svg image.

 optimizing 4 images in batches of 4 
 error   Expected one of: heic, heif, avif, jpeg, jpg, jpe, tile, dz, png, raw, tiff, tif, webp, gif, jp2, jpx, j2k, j2c for format but received svg of type string
  Code:
      123 | const invalidParameterError = function (name, expected, actual) {
    > 124 |   return new Error(
          |          ^
      125 |     `Expected ${expected} for ${name} but received ${actual} of type ${typeof actual}`
      126 |   );
      127 | };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: image Related to the `@astrojs/image` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants