diff --git a/CHANGELOG b/CHANGELOG index 53de059a3..f6b5608e7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ CHANGELOG Roundcube Webmail - Fix bug where a new saved search added after removing all searches wasn't added to the list (#7061) - Fix bug where a new contact group added after removing all groups from addressbook wasn't added to the list - Fix bug where Ctype extension wasn't required in Installer and INSTALL file (#7049) +- Fix so install-jsdeps.sh removes Bootstrap's sourceMappingURL (#7035) RELEASE 1.4.1 ------------- diff --git a/bin/install-jsdeps.sh b/bin/install-jsdeps.sh index 785c84e32..c09051816 100755 --- a/bin/install-jsdeps.sh +++ b/bin/install-jsdeps.sh @@ -237,7 +237,7 @@ function extract_zipfile($package, $srcfile) echo "Extracting files $pattern into $destdir\n"; exec(sprintf('%s -o %s %s -d %s', $UNZIP, escapeshellarg($srcfile), escapeshellarg($pattern), $destdir), $out, $retval); if ($retval !== 0) { - rcube::raise_error("Failed to unpack $pattern; " . join('; ' . $out)); + rcube::raise_error("Failed to unpack $pattern; " . implode('; ' . $out)); } } } @@ -258,22 +258,35 @@ function extract_zipfile($package, $srcfile) foreach ($package['map'] as $src => $dest) { echo "Installing $sourcedir/$src into $destdir/$dest\n"; + $dest_file = $destdir . '/' . $dest; + $src_file = $sourcedir . '/' . $src; + // make sure the destination's parent directory exists if (strpos($dest, '/') !== false) { - $parentdir = dirname($destdir . '/' . $dest); + $parentdir = dirname($dest_file); if (!is_dir($parentdir)) { mkdir($parentdir, 0775, true); } } // avoid copying source directory as a child into destination - if (is_dir($sourcedir . '/' . $src) && is_dir($destdir . '/' . $dest)) { - exec(sprintf('rm -rf %s/%s', $destdir, $dest)); + if (is_dir($src_file) && is_dir($dest_file)) { + exec(sprintf('rm -rf %s', $dest_file)); } - exec(sprintf('mv -f %s/%s %s/%s', $sourcedir, $src, $destdir, $dest), $out, $retval); + exec(sprintf('mv -f %s %s', $src_file, $dest_file), $out, $retval); if ($retval !== 0) { - rcube::raise_error("Failed to move $src into $destdir/$dest; " . join('; ' . $out)); + rcube::raise_error("Failed to move $src into $dest_file; " . implode('; ' . $out)); + } + // Remove sourceMappingURL + else if (isset($package['sourcemap']) && $package['sourcemap'] === false) { + if ($content = file($dest_file)) { + $index = count($content); + if (preg_match('|sourceMappingURL=|', $content[$index-1])) { + array_pop($content); + file_put_contents($dest_file, implode('', $content)); + } + } } } @@ -285,7 +298,7 @@ function extract_zipfile($package, $srcfile) echo "Extracting zip archive into $destdir\n"; exec(sprintf('%s -o %s -d %s', $UNZIP, escapeshellarg($srcfile), $destdir), $out, $retval); if ($retval !== 0) { - rcube::raise_error("Failed to unzip $srcfile; " . join('; ' . $out)); + rcube::raise_error("Failed to unzip $srcfile; " . implode('; ' . $out)); } } diff --git a/jsdeps.json b/jsdeps.json index 8d05b4df0..8638ac2b0 100644 --- a/jsdeps.json +++ b/jsdeps.json @@ -94,6 +94,7 @@ "sha1": "ee9e9d6bbbb6181dc519778af2b38804a6aa62a4", "license": "MIT", "flat": true, + "sourcemap": false, "map": { "bootstrap.bundle.min.js": "bootstrap.bundle.min.js", "bootstrap.min.css": "bootstrap.min.css"