diff options
| author | Noah Rosenzweig <[email protected]> | 2020-11-21 20:39:33 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-21 21:39:33 +0200 |
| commit | 21737ed530b7ac37fe1ce67026df373c04282ac8 (patch) | |
| tree | 146444e42297db1abf765eb5ff4cdfe0f28596b5 | |
| parent | d365831bce972ce089ebd89e91ba7c2cf6e13c5e (diff) | |
| download | bootstrap-21737ed530b7ac37fe1ce67026df373c04282ac8.tar.xz bootstrap-21737ed530b7ac37fe1ce67026df373c04282ac8.zip | |
Improve build/generate-sri.js regex (#29753)
When using single-quotes in config.yml, the previous
regular expression in build/generate-cli.js wasn't working correctly,
it was replacing ALL string values with hashes.
Now both double- and single-quotes can be used in config.yml,
and the RegExp will work as expected.
Also, allow trailing whitespaces and empty ("") values to be matched.
Co-authored-by: XhmikosR <[email protected]>
| -rw-r--r-- | build/generate-sri.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/build/generate-sri.js b/build/generate-sri.js index cfbf37771..de269b040 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -55,6 +55,6 @@ files.forEach(file => { console.log(`${file.configPropertyName}: ${integrity}`) - sh.sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), `$1${integrity}$3`, configFile) + sh.sed('-i', new RegExp(`^(\\s+${file.configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile) }) }) |
