mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-07 08:02:12 +01:00
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
|
||||
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
|
||||
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
|
||||
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
|
||||
const configs = files.map((file) => file.replace('.json', ''));
|
||||
|
||||
@@ -2,8 +2,9 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import fs from 'fs';
|
||||
|
||||
function Get(req: NextApiRequest, res: NextApiResponse) {
|
||||
// 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
|
||||
const configs = files.map((file) => file.replace('.json', ''));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user