From 803c94296cda6065ab4202dc01c890a1be4ee6b1 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Fri, 3 May 2024 16:39:04 +0100
Subject: [PATCH] Issue #3445072 by longwave, Anybody: Improve "The libraries
 to include are encoded incorrectly" check and message

---
 core/modules/system/src/Controller/AssetControllerBase.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/modules/system/src/Controller/AssetControllerBase.php b/core/modules/system/src/Controller/AssetControllerBase.php
index 0e25e72ab6fd..197af589cb6d 100644
--- a/core/modules/system/src/Controller/AssetControllerBase.php
+++ b/core/modules/system/src/Controller/AssetControllerBase.php
@@ -162,10 +162,11 @@ public function deliver(Request $request, string $file_name) {
     $attached_assets = new AttachedAssets();
     $include_libraries = explode(',', UrlHelper::uncompressQueryParameter($request->query->get('include')));
 
+    // Check that library names are in the correct format.
     $validate = function ($libraries_to_check) {
       foreach ($libraries_to_check as $library) {
-        if (substr_count($library, '/') !== 1) {
-          throw new BadRequestHttpException('The libraries to include are encoded incorrectly.');
+        if (substr_count($library, '/') === 0) {
+          throw new BadRequestHttpException(sprintf('The "%s" library name must include at least one slash.', $library));
         }
       }
     };
-- 
GitLab