Fixed copyright headers. Added mkdir for the destination directory. Fixed paths.
This commit is contained in:
parent
d15578a90e
commit
1030f44ee3
|
@ -95,7 +95,7 @@ License
|
|||
|
||||
Copyright (c) 2018 Enio Carboni - Italy
|
||||
|
||||
Copyright (C) 2019-2021 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
Copyright (C) 2019-2022 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
|
||||
fattura-elettronica-reader is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,7 +2,7 @@ Copyright and License
|
|||
=====================
|
||||
|
||||
Copyright (c) 2018 Enio Carboni - Italy
|
||||
Copyright (C) 2019-2021 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
Copyright (C) 2019-2022 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
|
||||
fattura-elettronica-reader is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# api.py
|
||||
#
|
||||
# Copyright (c) 2018 Enio Carboni - Italy
|
||||
# Copyright (C) 2019-2020 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
# Copyright (C) 2019-2022 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
|
||||
#
|
||||
# This file is part of fattura-elettronica-reader.
|
||||
#
|
||||
|
@ -312,8 +312,8 @@ def extract_attachments_from_invoice_file(
|
|||
:raises: base64.binascii.Error, filetype, atomicwrites, or a built-in exception.
|
||||
"""
|
||||
for at in invoice_file_xml_root.findall(invoice_file_xml_attachment_xpath):
|
||||
attachment = at.find(invoice_file_xml_attachment_tag).text
|
||||
attachment_relative = pathlib.Path(attachment).name
|
||||
attachment_content = at.find(invoice_file_xml_attachment_tag).text
|
||||
attachment_relative = pathlib.Path(at.find(invoice_file_xml_attachment_filename_tag).text).name
|
||||
attachment_dest_path = str(pathlib.Path(destination_directory, attachment_relative))
|
||||
|
||||
if not ignore_attachment_extension_whitelist:
|
||||
|
@ -327,7 +327,7 @@ def extract_attachments_from_invoice_file(
|
|||
# Just in case that there are alien characters in the base64 string
|
||||
# (sic, it happened!) we use validate=False as an option to skip them.
|
||||
decoded = base64.b64decode(
|
||||
attachment.encode(invoice_file_text_encoding), validate=False)
|
||||
attachment_content.encode(invoice_file_text_encoding), validate=False)
|
||||
if not ignore_attachment_filetype_whitelist:
|
||||
# See https://h2non.github.io/filetype.py/1.0.0/filetype.m.html#filetype.filetype.get_type
|
||||
if filetype.guess(
|
||||
|
@ -721,6 +721,9 @@ def pipeline(source: str, file_type: str, data: dict):
|
|||
project_name, const.Paths['configuration file'])
|
||||
if not pathlib.Path(configuration_file).is_file() or data['write default configuration file']:
|
||||
write_configuration_file(configuration_file)
|
||||
|
||||
pathlib.Path(data['destination directory']).mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
|
||||
if source != 'NOOP' and file_type != 'NOOP':
|
||||
config = yaml.load(open(configuration_file, 'r'), Loader=yaml.SafeLoader)
|
||||
|
||||
|
|
Loading…
Reference in New Issue