Fix not filtering .json files for config

This commit is contained in:
ajnart
2023-01-08 13:09:54 +09:00
parent c2a9ff44fd
commit 6f6888f6a7
4 changed files with 13 additions and 6 deletions

View File

@@ -246,7 +246,9 @@ function SwitchToggle() {
export async function getServerSideProps({ req, res, locale }: GetServerSidePropsContext) {
// Get all the configs in the /data/configs folder
const configs = fs.readdirSync('./data/configs');
// All the files that end in ".json"
const configs = fs.readdirSync('./data/configs').filter((file) => file.endsWith('.json'));
if (configs.length === 0) {
res.writeHead(302, {
Location: '/',