From 82da1339b5c32800e84a91ffc5ccbbdf0e90a779 Wed, 31 Dec 2014 03:26:57 +0100
From: hass <hass@85918.no-reply.drupal.org>
Date: Wed, 31 Dec 2014 03:26:48 +0100
Subject: [PATCH] Issue #2400287 by hass: Remove JS source and source mapping urls or these may cause 404 errors.

diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
index 68626ec..b4a0cad 100644
--- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
+++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php
@@ -123,6 +123,9 @@
                 // from running together.
                 $data .= ";\n";
               }
+              // Remove JS source and source mapping urls or these may cause 404
+              // errors.
+              $data = preg_replace('/\/\/(#|@)\s(sourceURL|sourceMappingURL)=\s*(\S*?)\s*$/m', '', $data);
               // Dump the optimized JS for this group into an aggregate file.
               $uri = $this->dumper->dump($data, 'js');
               // Set the URI for this group's aggregate file.
