- Issue created by @penyaskito
- πͺπΈSpain fjgarlin
Relevant code added in https://git.drupalcode.org/project/drupalorg/-/commit/b529b589904e2c8127...
Need to debug if it's still going inside that "if".
- πͺπΈSpain fjgarlin
I'm not sure if something has changed in the way that GitLab returns the image markup / src attribute, it might be that.
Adding something like this (you can copy/paste it on the issue) fixes the issue:
for (let image of document.querySelectorAll('img.lazy')) { image.setAttribute('src', image.dataset.src); }
I'll do an MR based on this.
- πͺπΈSpain fjgarlin
I think that the code is expecting this URL: https://git.drupalcode.org/-/project/dashboard/uploads/dd7a71233e84b4308...
But it's receiving this: https://git.drupalcode.org/-/project/552/uploads/dd7a71233e84b430861886d...
So it cannot parse the project name.
- πͺπΈSpain fjgarlin
The MR contains the suggested code.
You can test it copy/pasting this in the mentioned issue in the developer tools:
for (let image of document.querySelectorAll('img.lazy')) { const match = image.dataset.src.match(/^\/(?<projectPath>.+)\/uploads\/[0-9a-f]+\/[^\/]*$/); if (match !== null && match.groups.projectPath === projectPath) { image.setAttribute('loading', 'lazy'); image.setAttribute('src', Drupal.settings.drupalorgGitlabUrl + match[0]); } else if (image.dataset.src.startsWith(Drupal.settings.drupalorgGitlabUrl)) { image.setAttribute('loading', 'lazy'); image.setAttribute('src', image.dataset.src); } }
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
Works for me on the console, and code-wise looks clean! Thanks!
- First commit to issue fork.
-
drumm β
committed 315fdf63 on 7.x-3.x authored by
fjgarlin β
Issue #3491737: Update GitLab path image matching for new URL pattern in...
-
drumm β
committed 315fdf63 on 7.x-3.x authored by
fjgarlin β
- πΊπΈUnited States drumm NY, US
Looks good, and I donβt see a risk of embedding arbitrary images. Deployed!
-
drumm β
committed 315fdf63 on kc-event-handling-extras authored by
fjgarlin β
Issue #3491737: Update GitLab path image matching for new URL pattern in...
-
drumm β
committed 315fdf63 on kc-event-handling-extras authored by
fjgarlin β