Inconsistencies with page title case sensitivity

Page titles in Confluence are supposed to be case-insensitive. No two pages with the same title but different casing are allowed in the same space. And page references using the wrong casing are resolved properly. An example is when adding an Include Macro to a page. In the macro editor, the title of the included page can be typed in, and when typing it in wrong casing and saving without selecting one of the suggested pages, the Include Macro gets stored with an ri:page reference to the included page using the wrong casing, but it renders properly anyways.

Our use case is that we are fetching a page using the REST API, parsing the storage format, and replacing all the Include Macros with the content of their referenced pages. This has turned out to be a bit of a pain, because it turns out that the Confluence REST API seems to be case-sensitive about page titles whereas all other parts of Confluence are not.

For example, let’s assume we have a page “Page” in space “TEST” in our Confluence instance. Trying to access it using /rest/api/content?spaceKey=TEST&title=page or /rest/api/search?cql=title=page or /rest/api/content/search?cql=title=page does not return any results.

We have implemented a workaround that relies on CQL’s fuzzy search. We are looking up the page using /rest/api/search?cql=title=page (replacing the characters -?~"*:\ with a space in the page title, since those have a special meaning in the query). This is case-insensitive, but it also might return other pages whose title contains the word “page”. So what we do is fetch all the results (multiple result pages if needed) and then manually do a case-insensitive title comparison with all the pages returned in order to find the right one.

While this workaround works, it is not ideal, as sometimes pages are missing from the search index, and it can be much slower if the search returns a lot of results that have a similar page title.

There might be other fields that are not handled case-insensitively by the REST endpoints as well. The only thing that I have tested is the space key, and it seems that that is handled correctly.

Interestingly, it seems that on Server, the /rest/api/content endpoint behaves the opposite way: The space key is case sensitive, while the page title is not. The CQL endpoint behaves the same as on Cloud.

4 Likes

The rest API also has inconsistencies if group names contain a slash “/”, see e.g. https://jira.atlassian.com/browse/CONFCLOUD-68869

Some of this has changed on Cloud and I have done a deeper investigation: Finding a page by title, certain CQL queries crash the search

1 Like