gitea push
This commit is contained in:
+12
-8
@@ -31,18 +31,22 @@ module.exports = class FileExistsPlugin {
|
||||
const file = request.path;
|
||||
if (!file) return callback();
|
||||
fs.stat(file, (err, stat) => {
|
||||
if (err || !stat) {
|
||||
// Combine the two miss branches: a stat failure and a
|
||||
// "not a file" result share the same handling — record the
|
||||
// path on `missingDependencies`, log the right reason, then
|
||||
// bail. The error-message ternary picks the wording that
|
||||
// matched the failing condition.
|
||||
if (err || !stat || !stat.isFile()) {
|
||||
if (resolveContext.missingDependencies) {
|
||||
resolveContext.missingDependencies.add(file);
|
||||
}
|
||||
if (resolveContext.log) resolveContext.log(`${file} doesn't exist`);
|
||||
return callback();
|
||||
}
|
||||
if (!stat.isFile()) {
|
||||
if (resolveContext.missingDependencies) {
|
||||
resolveContext.missingDependencies.add(file);
|
||||
if (resolveContext.log) {
|
||||
resolveContext.log(
|
||||
err || !stat
|
||||
? `${file} doesn't exist`
|
||||
: `${file} is not a file`,
|
||||
);
|
||||
}
|
||||
if (resolveContext.log) resolveContext.log(`${file} is not a file`);
|
||||
return callback();
|
||||
}
|
||||
if (resolveContext.fileDependencies) {
|
||||
|
||||
Reference in New Issue
Block a user