Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-66959

Trailing non-breaking space in user's USER_KEY causes error when adding user to a project role

XMLWordPrintable

      Summary

      If a user was created with a trailing (or leading) non-breaking space on its username, this string will be used as the user_key for the user, even if the username is changed. This results in an error when trying to add this user to a project role, where the following error message will be presented: We can't find 'USERNAME' in any accessible user directory. Check they're still active and available, and try again.

      Steps to Reproduce

      1. Create a user using a trailing non-breaking space character (U+00A0).
      2. Attempt to add the user to a project role.

      Expected Results

      The user is added to the selected role.

      Actual Results

      The action to add the user to a role in the project fails with the following error message on the UI: We can't find 'USERNAME' in any accessible user directory. Check they're still active and available, and try again.
      No errors show up in the application logs about this.

      Notes

      This issue happens on all browsers.

      Workaround

      Note that we strongly advise against manually changing the user's USER_KEY through the database, as this can result in multiple inconsistencies on references made to this user in the database.

      At this time, the only known workaround is to capture the failed request using the browser's developer tools, correct the user_key on the request and then running this request through a cURL command.

      The instructions below are tailored to Google Chrome, but you should be able to capture this data with any browser.

      1. Navigate to the Users and roles page in a Project.
      2. Open the Network tab inside Developer Tools.
      3. Attempt to add the user to a role.
      4. Once it fails, you will notice a bad request (400).
      5. Right click on the failed request and select the Copy as cURL option.
      6. At the end on the request, you will find a JSON array listing the users that are supposed to be added to the role:
        '{"users":["USERNAME"],"groups":[]}'
        
      7. Without changing any other information on the request, add the non-breaking space to the username inside the array:
        '{"users":["USERNAME "],"groups":[]}'
        
      8. Run the request through the terminal. If the user is successfully added, the output of the cURL command will be as follows:
        {"numberOfGroupsAdded":0,"numberOfUsersAdded":1}
        

              Unassigned Unassigned
              lbugs Lucas Bugs
              Votes:
              18 Vote for this issue
              Watchers:
              25 Start watching this issue

                Created:
                Updated: