Fix not filtering .json files for config
This commit is contained in:
@@ -88,7 +88,9 @@ function Get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop over all the files in the /data/configs directory
|
// Loop over all the files in the /data/configs directory
|
||||||
const files = fs.readdirSync('data/configs');
|
// Get all the configs in the /data/configs folder
|
||||||
|
// All the files that end in ".json"
|
||||||
|
const files = fs.readdirSync('./data/configs').filter((file) => file.endsWith('.json'));
|
||||||
|
|
||||||
// Strip the .json extension from the file name
|
// Strip the .json extension from the file name
|
||||||
const configs = files.map((file) => file.replace('.json', ''));
|
const configs = files.map((file) => file.replace('.json', ''));
|
||||||
@@ -134,7 +136,9 @@ function Delete(req: NextApiRequest, res: NextApiResponse<any>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop over all the files in the /data/configs directory
|
// Loop over all the files in the /data/configs directory
|
||||||
const files = fs.readdirSync('data/configs');
|
// Get all the configs in the /data/configs folder
|
||||||
|
// All the files that end in ".json"
|
||||||
|
const files = fs.readdirSync('./data/configs').filter((file) => file.endsWith('.json'));
|
||||||
|
|
||||||
// Strip the .json extension from the file name
|
// Strip the .json extension from the file name
|
||||||
const configs = files.map((file) => file.replace('.json', ''));
|
const configs = files.map((file) => file.replace('.json', ''));
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
function Get(req: NextApiRequest, res: NextApiResponse) {
|
function Get(req: NextApiRequest, res: NextApiResponse) {
|
||||||
// Loop over all the files in the /data/configs directory
|
// Get all the configs in the /data/configs folder
|
||||||
const files = fs.readdirSync('data/configs');
|
// All the files that end in ".json"
|
||||||
|
const files = fs.readdirSync('./data/configs').filter((file) => file.endsWith('.json'));
|
||||||
// Strip the .json extension from the file name
|
// Strip the .json extension from the file name
|
||||||
const configs = files.map((file) => file.replace('.json', ''));
|
const configs = files.map((file) => file.replace('.json', ''));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user