Skip to content

Commit

Permalink
BUGFIX: not providing a --page_id for updates results in attachments …
Browse files Browse the repository at this point in the history
…not being uploaded to the correct page #24
  • Loading branch information
szn committed Sep 10, 2024
1 parent 696d35d commit 5e1b05c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/md2cf/utils/confluencemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -259,6 +259,7 @@ def __attach_images(
) -> None:
"""Replaces <img> html tags with Confluence specific <ac:image> 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):
Expand Down
2 changes: 1 addition & 1 deletion src/md2cf/utils/md2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5e1b05c

Please sign in to comment.