mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Minify: Treat ENOTDIR
like ENOENT
when statting a file
This avoids an exception when require-kernel requests a path like `existing-file.js/index.js`.
This commit is contained in:
parent
aaacbd3a7a
commit
e8df643d75
1 changed files with 1 additions and 1 deletions
|
@ -247,7 +247,7 @@ const statFile = async (filename, dirStatLimit) => {
|
||||||
try {
|
try {
|
||||||
stats = await fs.stat(path.resolve(ROOT_DIR, filename));
|
stats = await fs.stat(path.resolve(ROOT_DIR, filename));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code === 'ENOENT') {
|
if (['ENOENT', 'ENOTDIR'].includes(err.code)) {
|
||||||
// Stat the directory instead.
|
// Stat the directory instead.
|
||||||
const [date] = await statFile(path.dirname(filename), dirStatLimit - 1);
|
const [date] = await statFile(path.dirname(filename), dirStatLimit - 1);
|
||||||
return [date, false];
|
return [date, false];
|
||||||
|
|
Loading…
Reference in a new issue