Skip to content

Commit 4da1ee9

Browse files
MichaelKowalMichael Kowal
and
Michael Kowal
authoredOct 16, 2022
Check that license file is actually a file (#1231)
Co-authored-by: Michael Kowal <michael.kowal@vertigis.com>
1 parent 86a4bd3 commit 4da1ee9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/license-plugin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ class LicensePlugin {
191191
const absolutePath = path.join(dir, '[lL][iI][cC][eE][nN][cCsS][eE]*');
192192
const relativeToCwd = path.relative(cwd, absolutePath);
193193
const licenseFile = this._findGlob(relativeToCwd, cwd)[0];
194-
if (licenseFile) {
194+
// Add the license text if a license file exists
195+
if (fs.existsSync(licenseFile) && fs.lstatSync(licenseFile).isFile()) {
195196
pkg.licenseText = fs.readFileSync(licenseFile, 'utf-8');
196197
}
197198

0 commit comments

Comments
 (0)
Please sign in to comment.