update: optimized code.

This commit is contained in:
Stitch-z 2023-10-24 14:17:54 +08:00
parent 5e27ee4bad
commit 22d5094197

View file

@ -71,9 +71,8 @@ class InvoiceOCR(Action):
# Use CP437 to encode the file name, and then use GBK decoding to prevent Chinese garbled code
relative_name = Path(zip_info.filename.encode("cp437").decode("gbk"))
if relative_name.suffix:
name = relative_name.name
full_filename = file_directory / relative_name
await File.write(full_filename.parent, name, zip_ref.read(zip_info.filename))
await File.write(full_filename.parent, relative_name.name, zip_ref.read(zip_info.filename))
logger.info(f"unzip_path: {file_directory}")
return file_directory