From 5e1b05c205f105bd00a6aff40b9858534817016d Mon Sep 17 00:00:00 2001 From: SZN Date: Tue, 10 Sep 2024 18:11:48 +0200 Subject: [PATCH 1/2] BUGFIX: not providing a --page_id for updates results in attachments not being uploaded to the correct page #24 --- src/md2cf/utils/confluencemd.py | 5 +++-- src/md2cf/utils/md2html.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/md2cf/utils/confluencemd.py b/src/md2cf/utils/confluencemd.py index d534391..18e7b98 100644 --- a/src/md2cf/utils/confluencemd.py +++ b/src/md2cf/utils/confluencemd.py @@ -101,12 +101,12 @@ def update_existing(self, page_id: str = None) -> int: self.url = self.conf_url # to satisfy parent class html = self.__rewrite_issues(html) - self.__attach_images(page_id, images) - if page_id is None: logger.debug("Using `page_id` from `%s` file", self.md_file) page_id = page_id_from_meta + self.__attach_images(page_id, images) + assert page_id, ( f"Can't update page without page_id given either by " f"`--page_id` parameter or via `confluence-url` tag in `{self.md_file}` file" @@ -259,6 +259,7 @@ def __attach_images( ) -> None: """Replaces html tags with Confluence specific and uploads images as attachements""" + logger.info("__attach_images %s", page_id) for (_alt, path) in images: rel_path = os.path.join(self.md_file_dir, path) if not os.path.isfile(rel_path): diff --git a/src/md2cf/utils/md2html.py b/src/md2cf/utils/md2html.py index f6a30a4..6c606bd 100644 --- a/src/md2cf/utils/md2html.py +++ b/src/md2cf/utils/md2html.py @@ -86,7 +86,7 @@ def __rewrite_images(html: str, rel_path = os.path.join(md_file_dir, path) if not os.path.isfile(rel_path): assert os.path.isfile(path), f"File `{path}` does not exist" - logger.warning("file `%s` does not exist, using file relative to " + logger.debug("File `%s` does not exist, using file relative to " "current dir `%s`", rel_path, path) rel_path = path From 63fa1fcd459d749924adda6214c36aca5266a146 Mon Sep 17 00:00:00 2001 From: SZN Date: Tue, 10 Sep 2024 18:12:14 +0200 Subject: [PATCH 2/2] v0.4.5 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index dbd0361..e675fce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = confluence.md -version = 0.4.4 +version = 0.4.5 author = Szymon Nieradka description = Markdown to Confluence - upload any .md files to your Confluence cloud page long_description = file: README.md