The usage of "Drupal.url()" to load the script if needed does not respect pathPrefixes.

So if I'm on https://www.examle.com/en/a-page, using Drupal.url( 'libraries/lazysizes/lazysizes.min.js' ) would result in " https://www.examle.com/en/libraries/lazysizes/lazysizes.min.js". This should only use the basePath component of the URL, not the prefix.

CommentFileSizeAuthor
#2 use-basePath-3086717.patch678 bytesDrColossos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DrColossos created an issue. See original summary.

DrColossos’s picture

FileSize
678 bytes
osman’s picture

Good catch @DrColossos, and thanks for the patch.

However, I don't think drupalSettings.path.baseUrl alone would be enough.

On my multi-lingual site, I would need to use as drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix + libraries/lazysizes/lazysizes.min.js' to get the correct path.

I'll play around with this a bit. but of course you're welcome to share your findings and patches.

Cheers,
osman

  • osman committed 64a492e on 8.x-3.x authored by DrColossos
    Issue #3086717 by DrColossos: Respect multi-lingual pages
    
osman’s picture

Status: Active » Needs review
osman’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.