Oh. OMG. That was MY dirty fix 🙄 Guess I misinterpreted the diff, probably due to a lack of caffeine :-)
Anyways. This is the very commit that seems to fix the issue in CDN 4.0.2: https://git.drupalcode.org/project/cdn/-/commit/f6f3d0b5111aeaefe9443afa...
Ergo: the issue is fixed in CDN 4.0.2. Hooray!
@idflorin you need to test using CDN module version 4.0.1. Version 4.0.2 contains a dirty fix for this very issue :-)
# Dirty fix until https://www.drupal.org/project/cdn/issues/3388223 is fixed
if (str_starts_with($uri, '/sites/default/files/css/') || str_starts_with($uri, '/sites/default/files/js/')) {
$uri = substr($uri, 1);
}
I did some checks on my side:
10.1.4 + CDN 4.0.1 -> double slash
10.1.4 + CDN 4.0.2 -> no double slash
10.1.7 + CDN 4.0.1 -> double slash
10.1.7 + CDN 4.0.2 -> no double slash
So, nothing's fixed in 10.1.7.
Looks like it may be a core issue indeed.
In D9.5, core is passing uri's of the form public://css/css_aBcDe... to FileUrlGenerator.
From D10.0 onwards, core is passing uri's of the form /css/css_aBcDe... to FileUrlGenerator.
I have the same problem.
Steps to reproduce:
composer create-project drupal/recommended-project my_site_name
cd my_site_name/
composer require 'drupal/cdn:4.0.1'
composer require 'drush/drush:^11.0'
drush si
drush en cdn cdn_ui
Make sure aggregate CSS & JS is enabled on /admin/config/development/performance.
Now, surf to /admin/config/services/cdn and enable simple mapping. Serve all files from
and set status to Enabled.
Result: CSS & JS aggregates have an extra slash inserted.