forked from svrjs/svrjs
Optimized bad (broken) entry generation in directory listing
This commit is contained in:
parent
c44c796253
commit
f1c74cb036
1 changed files with 9 additions and 19 deletions
12
svr.js
12
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(
|
||||
"<tr><td style=\"width: 24px;\"><img src=\"/.dirimages/bad.png\" alt=\"[BAD]\" width=\"24px\" height=\"24px\" /></td><td style=\"word-wrap: break-word; word-break: break-word; overflow-wrap: break-word;\"><a href=\"" +
|
||||
(href + "/" + encodeURI(ename)).replace(/\/+/g, "/") +
|
||||
"\"><nocode>" +
|
||||
ename.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") +
|
||||
"</nocode></a></td><td>-</td><td>" +
|
||||
estats.mtime.toDateString() +
|
||||
(estats ? estats.mtime.toDateString() : "-") +
|
||||
"</td></tr>\r\n"
|
||||
);
|
||||
} else {
|
||||
directoryListingRows.push(
|
||||
"<tr><td style=\"width: 24px;\"><img src=\"/.dirimages/bad.png\" alt=\"[BAD]\" width=\"24px\" height=\"24px\" /></td><td style=\"word-wrap: break-word; word-break: break-word; overflow-wrap: break-word;\"><a href=\"" +
|
||||
(href + "/" + encodeURI(ename)).replace(/\/+/g, "/") +
|
||||
"\"><nocode>" +
|
||||
ename.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") +
|
||||
"</nocode></a></td><td>-</td><td>-</td></tr>\r\n"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
var entry = "<tr><td style=\"width: 24px;\"><img src=\"[img]\" alt=\"[alt]\" width=\"24px\" height=\"24px\" /></td><td style=\"word-wrap: break-word; word-break: break-word; overflow-wrap: break-word;\"><a href=\"" +
|
||||
(origHref + "/" + encodeURIComponent(ename)).replace(/\/+/g, "/") +
|
||||
|
|
Reference in a new issue