Bug fix
This commit is contained in:
@@ -48,9 +48,16 @@ router.get("/enable", async (req, res) => {
|
||||
router.delete("/remove", async (req, res) => {
|
||||
logger.info(`${req.method}: "${req.url}" => ${req.get("User-Agent")}`);
|
||||
|
||||
if (req.query["element"]) {
|
||||
var element = req.query["element"];
|
||||
if (element) {
|
||||
try {
|
||||
fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, req.query["element"]));
|
||||
fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, element));
|
||||
if (fs.existsSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"))) {
|
||||
selected_map_name = fs.readFileSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"), "utf-8");
|
||||
if (selected_map_name == element) {
|
||||
fs.unlinkSync(path.join(path.dirname(require.main.filename), map_conf.map_storage_path, "selected"));
|
||||
}
|
||||
}
|
||||
res.status(200).send();
|
||||
} catch (error) {
|
||||
res.status(500).send();
|
||||
|
||||
Reference in New Issue
Block a user