allnet: fix error parsing dli files

This commit is contained in:
Hay1tsme 2024-01-09 19:10:54 -05:00
parent 8a99f94c93
commit 805b8f5b3e

View File

@ -345,7 +345,7 @@ class AllnetServlet:
return PlainTextResponse(res_str) return PlainTextResponse(res_str)
async def handle_dlorder_ini(self, request: Request) -> bytes: async def handle_dlorder_ini(self, request: Request) -> bytes:
req_file = request.path_params.get("file", "").replace("%0A", "") req_file = request.path_params.get("file", "").replace("%0A", "").replace("\n", "")
if not req_file: if not req_file:
return PlainTextResponse(status_code=404) return PlainTextResponse(status_code=404)
@ -355,7 +355,7 @@ class AllnetServlet:
await self.data.base.log_event("allnet", "DLORDER_INI_SENT", logging.INFO, f"{Utils.get_ip_addr(request)} successfully recieved {req_file}") await self.data.base.log_event("allnet", "DLORDER_INI_SENT", logging.INFO, f"{Utils.get_ip_addr(request)} successfully recieved {req_file}")
return PlainTextResponse(open( return PlainTextResponse(open(
f"{self.config.allnet.update_cfg_folder}/{req_file}", "r" f"{self.config.allnet.update_cfg_folder}/{req_file}", "r", encoding="utf-8"
).read()) ).read())
self.logger.info(f"DL INI File {req_file} not found") self.logger.info(f"DL INI File {req_file} not found")