mirror of
https://github.com/obra/superpowers.git
synced 2026-06-15 23:29:04 +08:00
Harden root screen containment
This commit is contained in:
@@ -186,8 +186,10 @@ function getNewestScreen() {
|
||||
.filter(f => !f.startsWith('.') && f.endsWith('.html'))
|
||||
.map(f => {
|
||||
const fp = path.join(CONTENT_DIR, f);
|
||||
if (!isRegularFileInsideContentDir(fp)) return null;
|
||||
return { path: fp, mtime: fs.statSync(fp).mtime.getTime() };
|
||||
})
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => b.mtime - a.mtime);
|
||||
return files.length > 0 ? files[0].path : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user