Full path for attachments sometimes includes responsive data

Created on 4 January 2024, 11 months ago
Updated 30 January 2024, 10 months ago

Problem/Motivation

When testing πŸ“Œ Drupal 11 compatibility changes Postponed , some webp images weren't seeding on the recipes page of the Umami profile. In some cases, the [full_path] value is including 1x from the srcset, e.g.

<source srcset="/sites/default/files/styles/scale_crop_7_3_wide/public/vegan-brownies-hero-umami.jpg.webp?itok=mOV_7Acn 1x" media="all and (min-width: 1400px)" type="image/webp" width="3000" height="1285">
              <source srcset="/sites/default/files/styles/scale_crop_7_3_large/public/vegan-brownies-hero-umami.jpg.webp?itok=0_b82U2r 1x" media="all and (min-width: 800px) and (max-width: 1400px)" type="image/webp" width="1440" height="617">
              <source srcset="/sites/default/files/styles/scale_crop_7_3_medium/public/vegan-brownies-hero-umami.jpg.webp?itok=A9_Np84o 1x" media="all and (min-width: 500px) and (max-width: 800px)" type="image/webp" width="1200" height="514">
              <source srcset="/sites/default/files/styles/scale_crop_7_3_tiny/public/vegan-brownies-hero-umami.jpg.webp?itok=DI5cHAO5 1x" media="all" type="image/webp" width="500" height="214">

The webp image styles seeded fine if they were already generated. But, when the image style needed to be generated, in one case, it had the " 1x" tacked onto the full_path which caused the image style not to be generated and thus not be seeded. In this case, it was this one:

/sites/default/files/styles/scale_crop_7_3_tiny/public/vegan-brownies-hero-umami.jpg.webp?itok=DI5cHAO5 1x

Steps to reproduce

This was seen using the Drupal 11 PR branch. Umami was reworked in D11 to use image styles for the recipes page for better performance. It's possible this same issue would be present in Drupal 9 or 10 but we'd have to set up responsive images in a similar way. Plus, it's only one of the webp images that's doing this so it's unclear if we'd be able to reproduce reliably.

Proposed resolution

As it's unclear how the extra information is getting added, the simplest fix for now is probably stripping off any extra info past the regular query string.

Remaining tasks

  • Update code
  • Review and test
  • Commit :)

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Postponed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024