Merge pull request #13 from Stitch-z/feature-invoice-ocr-assistant

update: optimized code.
This commit is contained in:
Stitch-z 2023-10-24 14:19:43 +08:00 committed by GitHub
commit c3c97d9ad8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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