From f1c74cb036a4cdbe9de735f5594a676009b3d7b5 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 17 Mar 2024 00:57:47 +0100 Subject: [PATCH] Optimized bad (broken) entry generation in directory listing --- svr.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/svr.js b/svr.js index 14c9211..3cfe581 100644 --- a/svr.js +++ b/svr.js @@ -3703,25 +3703,15 @@ if (!cluster.isPrimary) { var estats = filelist[i].stats; var ename = filelist[i].name; if (filelist[i].errored) { - if (estats) { - directoryListingRows.push( - "\"[BAD]\"" + - ename.replace(/&/g, "&").replace(//g, ">") + - "-" + - estats.mtime.toDateString() + - "\r\n" - ); - } else { - directoryListingRows.push( - "\"[BAD]\"" + - ename.replace(/&/g, "&").replace(//g, ">") + - "--\r\n" - ); - } + directoryListingRows.push( + "\"[BAD]\"" + + ename.replace(/&/g, "&").replace(//g, ">") + + "-" + + (estats ? estats.mtime.toDateString() : "-") + + "\r\n" + ); } else { var entry = "\"[alt]\"