"Search on other pages" fails to return attachments in spaces with keys starting with a digit or personal space keys

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 7.13.8, 8.0.0, 9.2.25, 10.2.18
    • Component/s: Content - Attachments
    • None
    • 2
    • Severity 3 - Minor

      Issue Summary

      The frontend script constructing the __ /rest/api/search?cql=... request in the Insert files and images > Search on other pages dialog omits double quotes around space.key. This breaks search for any space key starting with a digit or personal spaces (~username).

      • The client-side JavaScript constructs the CQL filter dynamically by appending the selected space key unquoted: 
        AND space.key = 1Test
        
      • It should instead quote the space key to ensure valid syntax regardless of the space key format: 
        AND space.key = "2DEF"

      Steps to Reproduce

      1. Create a space with a key starting with a digit/number (e.g. 1Test) or a personal space.
      2. Create a page in that space and add an attachment to it
      3. Create a new page and go to "Insert Files & Images" option
      4. Choose "Search on other pages"
      5. Enter the name of the file, which was uploaded in step 2
      6. Choose to search the current space (from the drop down instead of “All Spaces”) and click on "Search"

      Expected Results

      Confluence correctly queries /rest/api/search?cql=... AND space.key = "1Test" and displays matching attachments.

      Actual Results

      • Confluence queries /rest/api/search?cql=... AND space.key = 1Test without double quotes.
      • The backend CQL parser throws a 400 Bad Request, causing the search to display nothing

      Here are the corresponding access log responses for both test cases (affected space search vs. all spaces search):

      --Seach within the space 1Test:
      
      172.50.0.2 admin [05/Oct/2026:18:22:14 +0000] "GET /confluence/rest/api/search?cql=(title%20~%20%22welcome.png*%22%20OR%20parent.title%20~%20%22welcome.png*%22)%20AND%20type%20%3D%20attachment%20AND%20space.key%20%3D%201TES&expand=content.version%2Ccontent.container%2Ccontent.space&limit=50&_=1791224072806 HTTP/1.1" 400 244 11138 /confluence/rest/api/search http-nio-8090-exec-9 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36"
      
      --Search within all the space:
      
      172.50.0.2 admin [05/Oct/2026:18:22:36 +0000] "GET /confluence/rest/api/search?cql=(title%20~%20%22welcome.png*%22%20OR%20parent.title%20~%20%22welcome.png*%22)%20AND%20type%20%3D%20attachment&expand=content.version%2Ccontent.container%2Ccontent.space&limit=50&_=1791224072808 HTTP/1.1" 200 4138 230573 /confluence/rest/api/search http-nio-8090-exec-29 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36"
      

      HAR file: confluence.atlassian.internal.har

      Workaround

      Choose to search “All Spaces” from the drop down instead of the current space

              Assignee:
              Unassigned
              Reporter:
              Tomoya Suzuki
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: