You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the docs you can change the space key on per-document basis:
<!-- confluence-space-key: DAP -->
This overrides the default space set via command-line arguments or environment variables.
This doesn't seem to work for me (someother is another valid space key) :
$ head testing.md -n2
<!-- confluence-page-id: 367198209 -->
<!-- confluence-space-key: ~62dfb0d2b6b0b70770d7d76c -->
$ python3 -m md2conf testing.md -s someother
2023-08-23 12:39:34,798 - INFO - _synchronize_page [87] - Synchronizing page: testing.md
2023-08-23 12:39:34,978 - INFO - update_page [363] - Updating page: 367198209
2023-08-23 12:39:35,086 - ERROR - <module> [89] - 400 Client Error: Bad Request for url: https://atix.atlassian.net/wiki/rest/api/content/367198209
2023-08-23 12:39:35,086 - ERROR - <module> [94] - {'statusCode': 400, 'data': {'authorized': True, 'valid': False, 'errors': [{'message': {'key': "You can't change an existing page's space.", 'args': []}}], 'successful': False}, 'message': 'com.atlassian.confluence.api.service.exceptions.BadRequestException: Could not update Content of type : class com.atlassian.confluence.pages.Page with id 367198209'}
Another question is why is there a space key required via command-line arguments or environment variables at all? A space key tag in the document should be sufficient or not?
$ echo $CONFLUENCE_SPACE_KEY
$ head testing.md -n2
<!-- confluence-space-key: ~62dfb0d2b6b0b70770d7d76c -->
<!-- confluence-page-id: 367198209 -->
$ python3 -m md2conf testing.md
Traceback (most recent call last):
File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/jloeser/devel/envs/md2conf-env/lib/python3.10/site-packages/md2conf/__main__.py", line 82, in <module>
with ConfluenceAPI(
File "/home/jloeser/devel/envs/md2conf-env/lib/python3.10/site-packages/md2conf/api.py", line 117, in __init__
raise ConfluenceError("Confluence space key not specified")
md2conf.api.ConfluenceError: Confluence space key not specified
I suppose the problem is that your Confluence space name contains a ~ character, and the regular expression for the confluence-space-key tag value is currently defined as (\w+), in which \w is typically equivalent to [a-zA-Z_0-9]. We could update the regular expression to be more permissive in the characters it accepts.
The regular expression has been changed from (\w+) to (\S+) to capture ~ and other non-whitespace characters in the Confluence space name.
Thanks, the tilde prefix occurs on personal spaces in Confluence from what I see. With this fix at least the first issue is gone 👍
Still my question:
[...] why is there a space key required via command-line arguments or environment variables at all? A space key tag in the document should be sufficient or not?
According to the docs you can change the space key on per-document basis:
This doesn't seem to work for me (
someother
is another valid space key) :Another question is why is there a space key required via command-line arguments or environment variables at all? A space key tag in the document should be sufficient or not?
Tested version of md2conf is revision 6627f42.
The text was updated successfully, but these errors were encountered: