Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not providing a --page_id for updates results in attachments not being uploaded to the correct page #24

Closed
mxmo0rhuhn opened this issue Sep 9, 2024 · 1 comment · Fixed by #25
Assignees

Comments

@mxmo0rhuhn
Copy link

Hi again,
I am still more than happy about the tool - thanks again for the great work! We're now using it for nearly all repositories :)

Following up on #21 I realized that not providing a --page_id when invoking the scripts results in the attachments not being uploaded to the correct page (was not able to figure out where exactly they land).

Example (not working):

confluence.md -v --user $CONFLUENCE_USER --token $CONFLUENCE_TOKEN --add_info update --file database.md 
13:09:01 >  Updates page content based on given page_id or metadata in Markdown file        
13:09:01 > Updating page `None` based on `md_file` file
13:09:01 > Converting MD to HTML
13:09:01 > Getting list of images from MD file
13:09:01 >   - found image database_erd.png
13:09:01 >   - found image database_sensitive_erd.png
13:09:01 > Looking for host and page_id in https://somewiki.atlassian.net/wiki/spaces/OI/pages/123456/Some+databases url
13:09:01 >   found page_id `190808065` and host `https://somewiki.atlassian.net`
13:09:01 > replace image tag `<img src="database_erd.png" alt="ERD" />` with `<ac:image> <ri:attachment ri:filename="database_erd.png" /></ac:image>`
13:09:01 > replace image tag `<img src="database_sensitive_erd.png" alt="ERD sensitive" />` with `<ac:image> <ri:attachment ri:filename="database_sensitive_erd.png" /></ac:image>`
13:09:01 > Using URL (https://somewiki.atlassian.net) from `database.md` file
13:09:01 > register image file `database_erd.png`
13:09:03 > register image file `database_sensitive_erd.png`
13:09:04 > Using `page_id` from `database.md` file
13:09:04 > Getting page title from page id `190808065`
13:09:04 > Updating page_id `190808065` titled `Some databases`
13:09:05 >  End update 

Example (working):

$ confluence.md -v --user $CONFLUENCE_USER --token $CONFLUENCE_TOKEN --add_info update --file database.md --page_id 190808065
13:09:25 >  Updates page content based on given page_id or metadata in Markdown file        
13:09:25 > Updating page `190808065` based on `md_file` file
13:09:25 > Converting MD to HTML
13:09:25 > Getting list of images from MD file
13:09:25 >   - found image database_erd.png
13:09:25 >   - found image database_sensitive_erd.png
13:09:25 > Looking for host and page_id in https://somewiki.atlassian.net/wiki/spaces/OI/pages/190808065/Some+databases url
13:09:25 >   found page_id `190808065` and host `https://somewiki.atlassian.net`
13:09:25 > replace image tag `<img src="database_erd.png" alt="ERD" />` with `<ac:image> <ri:attachment ri:filename="database_erd.png" /></ac:image>`
13:09:25 > replace image tag `<img src="database_sensitive_erd.png" alt="ERD sensitive" />` with `<ac:image> <ri:attachment ri:filename="database_sensitive_erd.png" /></ac:image>`
13:09:25 > Using URL (https://somewiki.atlassian.net) from `database.md` file
13:09:25 > register image file `database_erd.png`
13:09:26 > register image file `database_sensitive_erd.png`
13:09:27 > Getting page title from page id `190808065`
13:09:27 > Updating page_id `190808065` titled `Some databases`
13:09:28 >  End update                                                         

It's a bit tricky as both traces claim to have registered the images. However, only in the second case they're actually an attachment to the correct page.

@szn szn self-assigned this Sep 10, 2024
szn added a commit that referenced this issue Sep 10, 2024
@szn szn linked a pull request Sep 10, 2024 that will close this issue
@szn
Copy link
Owner

szn commented Sep 10, 2024

Thanks @mxmo0rhuhn for the report. Indeed there was an obvious bug.

It's fixed now:

pip install --upgrade confluence.md

@szn szn closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants