Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-20512

Fix uri handling when containing brackets

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 7.10, 8.3
    • Fix Version/s: 7.10-HF18, 8.10
    • Component/s: Web Common
    • Backlog priority:
      600
    • Sprint:
      nxfit 8.4.8, nxfit 8.10.1, nxfit 8.10.2, nxfit 9.1.1
    • Story Points:
      3

      Description

      1. create a workspace with brackets in its name
      2. create a Node.JS client script:
        var Nuxeo = require('nuxeo');
        
        var nuxeo = new Nuxeo({
          auth: {
            method: 'basic',
            username: 'Administrator',
            password: 'Administrator'
          }
        });
        
        nuxeo.repository().fetch('/default-domain/workspaces/[trucspace]');
        

      This will generate the following stack trace:

      2016-09-20 12:25:22,174 ERROR [http-bio-0.0.0.0-8080-exec-36] [nuxeo-error-log] java.lang.IllegalArgumentException: Illegal characters in: /v1/repo/default/path/default-domain/workspaces/[trucspace]
      	at org.nuxeo.common.utils.URIUtils.quoteURIPathComponent(URIUtils.java:193)
      	at org.nuxeo.common.utils.URIUtils.quoteURIPathComponent(URIUtils.java:163)
      	at org.nuxeo.ecm.restapi.server.APIServlet.service(APIServlet.java:45)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      

      Checking URIUtils.quoteURIPathComponent:

      try {
                  // fake scheme so that a colon is not mistaken as a scheme
                  uri = new URI("x", s, null);
              } catch (URISyntaxException e) {
                  throw new IllegalArgumentException("Illegal characters in: " + s, e);
              }
      

      This is the expected behavior of URI according to RFC3986.

      This prevents access via REST to Documents containing brackets.

      Perhaps URL encoding only the brackets right before the URI object creation would allow this to work?

      But at the client end using the following:

      nuxeo.repository().fetch('/default-domain/workspaces/%5Btrucspace%5D');
      

      does not work because it is already decoded when arriving in URIUtils.quoteURIPathComponent.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days
                  2d