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

Unclear error when a page title is identical to that of the parent-id #142

Closed
feliksik opened this issue Jan 24, 2024 · 5 comments · Fixed by #163
Closed

Unclear error when a page title is identical to that of the parent-id #142

feliksik opened this issue Jan 24, 2024 · 5 comments · Fixed by #163
Labels
bug Something isn't working

Comments

@feliksik
Copy link

With confluence-publisher, I used to provide my root asciidoc-page as 'ancestor'. Not sure if this was the intention, but it works. This way, the ancestor is replaced by the root asciidoc page, instead of it being attached under it.

Text2confl accepts a parent-id instead of ancestor. It seems like the text2confl managed pages will be attached as children to the parent-id. Thus the parent-id is not be overwritten, but managed manually.

I'm not sure which of these approaches is the safest; but with text2confl, when one of the pages actually has the title of the existing parent-id, it tries to update them, but also provides it's own ID as the parent:

PUT https://confluence.myorg.example.com/rest/api/content/439755396

{
  "type": "page",
  "title": "My Title",
  "ancestors": [
    {
      "id": "439755396"
    }
  ],
  "version": {
    "number": 3,
    "minorEdit": false,
    "message": "Automated upload by text2confl"
  }
}

Note how the id in the PUT URL and the body are the same.

This fails with a vague error that cost me a lot of time to figure out:

Exception in thread "main" java.lang.RuntimeException: Failed to update 439755396: {"statusCode":500,"message":"","reason":"Internal Server Error"}
	at com.github.zeldigas.confclient.ConfluenceClientImpl.performPageUpdate(ConfluenceClientImpl.kt:204)

Also, when a text2conf page as the same title as another page that is not under the same ancestor, weird stuff happens: the existing page if updated and moved into the uploaded tree. It is more likely that this is a mistake by the user, if this page is not originally under the parent page.

@zeldigas
Copy link
Owner

Hello, thank you for the report. I'll prepare a fix that will check for clash with parent ID title.

As for "stealing" pages that are not under parent - that's a good question if this user mistake or intention. I think it is usually the latter, but I can add some marker in upload logs to highlight such scenarios or a command line option to detect this and fail.

@feliksik
Copy link
Author

Thanks, that sounds great. I made a separate report #144 to detail the "page stealing" issue, as I think the title is a poor identifier, and leads to bigger problems. I'd be happy to help fix this!

@feliksik
Copy link
Author

feliksik commented Jan 31, 2024

I only just discovered the option to provide a tenant, which is very useful, although it could still be useful to provide the option to prevent stealing of pages that are not associated with a tenant.

@zeldigas
Copy link
Owner

zeldigas commented Feb 3, 2024

@feliksik Tenants are designed to allow you to use text2confl from multiple page sources (e.g. separate git repos with docs) and avoid pages removal and stealing during cleanup. For single source publications this will not help you unfortunately.

I'm planning to fix issue with parent title this weekend.

As for detection of stealing pages in general - let's continue discussion in #144

@zeldigas
Copy link
Owner

@feliksik it took a while to find time and fix this, but now there will be dedicated error for this scenario. Available in latest docker image, will create new release soon to have it included in version

dgautier pushed a commit to text2confl/text2confl that referenced this issue Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants