Skip to content

Commit

Permalink
sort entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime-J committed Feb 4, 2021
1 parent 525ac31 commit 0a44aa9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ module.exports = ({ sharedPath: sharedPathIn, port, maxUploadSize, zipCompressio
const curRelPath = req.query.p || '/';
const curAbsPath = getFilePath(curRelPath);

const readdirEntries = await fs.readdir(curAbsPath);
let readdirEntries = await fs.readdir(curAbsPath);
readdirEntries = readdirEntries.sort(new Intl.Collator(undefined, {numeric: true}).compare);

const ret = (await pMap(readdirEntries, async (entry) => {
const fileAbsPath = join(curAbsPath, entry); // TODO what if a file called ".."
Expand Down

0 comments on commit 0a44aa9

Please sign in to comment.