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

Local image URL detection loses query arguments #290

Open
Berdir opened this issue Mar 23, 2021 · 0 comments
Open

Local image URL detection loses query arguments #290

Berdir opened this issue Mar 23, 2021 · 0 comments

Comments

@Berdir
Copy link
Contributor

Berdir commented Mar 23, 2021

If you have an image URL like "/sites/default/files/styles/my_style/public/foo/bar/image.jpg?itok=gz66czQz", which is common in Drupal, then the parsing drops the itok query argument, so if the generated image doesn't exist yet, it results in a 404 page. That results in not showing the image at all, and even worse, it seems to trigger a weird condition where the fast image size detection library seems to run into a weird 60s-per-image timeout, making the amp sites very, very slow.

\Lullabot\AMP\Pass\ImgTagTransformPass::getImageUrl() needs to be extended to keep the query arguments. FWIW, I'm not sure why it even bothers to use the parsed string for relative src attributes, it could just work with the original input and check that for being root-relative.

We have a custom image formatter, I think relative URL's are currently uncommon in core due to caching issues, but eventually, the default formatter will fix this, at this point it will be a lot more common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant