Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-61819

UI Document Viewer fails with documents whose ID contains a null character

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown

    Description

      While investigating CBSE-16961 I discovered that the document viewer UI fails to display some of the documents when a document ID contains the null character. I'm not sure why anyone would want a document ID containing a null character, but KV supports them, so the UI should as well.

      Here is an example of the problem. The BadNames default collection has a null character at the beginning of the id. When displayed, the summary says 4 results, but the null character stops the HTML rendering of the results:

       

      The fix is quite simple. The null character is confusing the HTML rendering, so the code needs to replace it with something else. The following example shows the same results with null replaced by ^@ 

      How to create a document with a null character in the id? The UI does not permit this, but it can be done with the documents REST API:

      curl -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -X POST -d 'flags=33554438&value=%7B%22hello%22%3A%20%22world%22%7D' http://Administrator:<password>@localhost:9000/pools/default/buckets/BadNames/scopes/_default/collections/_default/docs/%00key2

       

      Attachments

        1. image-2024-05-09-11-09-54-433.png
          688 kB
          Eben Haber
        2. image-2024-05-09-11-11-07-530.png
          911 kB
          Eben Haber
        3. image-2024-05-09-11-13-30-674.png
          911 kB
          Eben Haber
        For Gerrit Dashboard: MB-61819
        # Subject Branch Project Status CR V

        Activity

          People

            eben Eben Haber
            eben Eben Haber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty