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

Incorrect transform returned by parseURL #10273

Closed
1 task
onemen opened this issue Feb 29, 2024 · 0 comments · Fixed by #10274
Closed
1 task

Incorrect transform returned by parseURL #10273

onemen opened this issue Feb 29, 2024 · 0 comments · Fixed by #10274
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: assets Related to the Assets feature (scope) regression

Comments

@onemen
Copy link

onemen commented Feb 29, 2024

Astro Info

Astro                    v4.4.5
Node                     v20.11.1
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/starlight
                         @astrojs/tailwind
                         astro-expressive-code
                         @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Starting from version 4.4.5 Astro fail to load all images on astro dev

The same error triggered in version 4.4.6

Could not process image request: Error: Incorrect transform returned by `parseURL`
    at Module.GET (C:/code/tabmixplus-docs/node_modules/.pnpm/astro@4.4.5_typescript@5.3.3/node_modules/astro/dist/assets/endpoint/node.js:60:13)

The fix to #10199 causing this problem: 6aa660a

  if (removeParams && url.pathname !== "/_image") {
    url.search = "";
  }

When astro config does not have base url.pathname is "/_image" and everything work as expected, however when I set base in astro config, in my case '/tabmixplus-docs', then url.pathname is /tabmixplus-docs/ and the code above remove url.search.

when the code in assets/endpoint/node call const transform = await imageService.parseURL(url, imageConfig); the result is undefined since parseURL check for url.searchParams then this error is triggered

    if (!transform?.src) {
      throw new Error("Incorrect transform returned by `parseURL`");
    }

What's the expected result?

imageService should work on development with or without baseUrl

Link to Minimal Reproducible Example

https://github.com/onemen/astro-image-bug

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 29, 2024
@Princesseuh Princesseuh added - P4: important Violate documented behavior or significantly impacts performance (priority) feat: assets Related to the Assets feature (scope) regression and removed needs triage Issue needs to be triaged labels Feb 29, 2024
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) feat: assets Related to the Assets feature (scope) regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants