forked from Hay1tsme/artemis
fixing handle_data for Crossbeats
This commit is contained in:
parent
94c326a27d
commit
4b22bd734e
@ -124,35 +124,42 @@ class CxbServlet(BaseServlet):
|
|||||||
func_to_find = "handle_data_"
|
func_to_find = "handle_data_"
|
||||||
version_string = "Base"
|
version_string = "Base"
|
||||||
internal_ver = 0
|
internal_ver = 0
|
||||||
|
version = 0
|
||||||
|
|
||||||
if req_json == {}:
|
if req_json == {}:
|
||||||
self.logger.warning(f"Empty json request to /data")
|
self.logger.warning(f"Empty json request to /data")
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
|
subcmd = list(req_json.keys())[0]
|
||||||
|
if subcmd == "dldate":
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not type(req_json["dldate"]) is dict
|
not type(req_json["dldate"]) is dict
|
||||||
or "filetype" not in req_json["dldate"]
|
or "filetype" not in req_json["dldate"]
|
||||||
):
|
):
|
||||||
self.logger.warning(f"Malformed dldate request: {req_json}")
|
self.logger.warning(f"Malformed dldate request: {req_json}")
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
filetype = req_json["dldate"]["filetype"]
|
filetype = req_json["dldate"]["filetype"]
|
||||||
filetype_split = filetype.split("/")
|
filetype_split = filetype.split("/")
|
||||||
|
|
||||||
if len(filetype_split) < 2 or not filetype_split[0].isnumeric():
|
if len(filetype_split) < 2 or not filetype_split[0].isnumeric():
|
||||||
self.logger.warning(f"Malformed dldate request: {req_json}")
|
self.logger.warning(f"Malformed dldate request: {req_json}")
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
version = int(filetype_split[0])
|
version = int(filetype_split[0])
|
||||||
filename = filetype_split[len(filetype_split) - 1]
|
filename = filetype_split[len(filetype_split) - 1]
|
||||||
|
|
||||||
match = re.match(
|
match = re.match(
|
||||||
"^([A-Za-z]*)(\d\d\d\d)$", filetype_split[len(filetype_split) - 1]
|
"^([A-Za-z]*)(\d\d\d\d)$", filetype_split[len(filetype_split) - 1]
|
||||||
)
|
)
|
||||||
if match:
|
if match:
|
||||||
func_to_find += f"{inflection.underscore(match.group(1))}xxxx"
|
func_to_find += f"{inflection.underscore(match.group(1))}xxxx"
|
||||||
|
else:
|
||||||
|
func_to_find += f"{inflection.underscore(filename)}"
|
||||||
else:
|
else:
|
||||||
func_to_find += f"{inflection.underscore(filename)}"
|
filetype = subcmd
|
||||||
|
func_to_find += filetype
|
||||||
|
|
||||||
func_to_find += "_request"
|
func_to_find += "_request"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user