refactor: change attachment output path

for better clarity on the output, we're prefixing the name of the container page
to the path of the attachment (as its parent directory).
This commit is contained in:
Rodweil, Theodor 2023-08-07 18:58:11 +02:00
parent 00be0ff210
commit d79ada241c
No known key found for this signature in database
GPG key ID: F8BC1B0EB1F9CCF5

View file

@ -228,16 +228,11 @@ class ConfluencePublisher(_ConfluencePublisher):
""" """
logger.info('pass-through intercept: store_attachment') logger.info('pass-through intercept: store_attachment')
# 😭 i wanted to use this method so bad, but since we're ditching
# hashing altogether, this isn't necessary. We'll keep it as an
# orbituary 🪦
# mime_extension = guess_extension(mimetype, False)
file_name = quote_plus(name) file_name = quote_plus(name)
output_basepath = Path(getattr(self.config, 'xconfluence_outdir')) output_basepath = Path(getattr(self.config, 'xconfluence_outdir'))
file_ = output_basepath / 'attachments' / file_name file_ = output_basepath / 'attachments' / quote_plus(page_id) / file_name
file_.parent.mkdir(parents = True, exist_ok = True) file_.parent.mkdir(parents = True, exist_ok = True)