Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-68001

[backend] Labels with + characters cannot be deleted.

    XMLWordPrintable

Details

    Description

      Issue Summary

      Labels containing + characters are not able to be deleted.
      In our internal logs we can see the character is not being HTML encoded and is therefore taken as literal for example:

      Steps to Reproduce

      1. Create a confluence page.
      2. Add a label containing a + symbol.
      3. Try to delete the label.

      Expected Results

      1. The label should be deleted.
      2. The label should not able to created.

      Actual Results

      The label is created and subsequently cannot be removed via the UI and the below error is displayed:

      Notes

      This error is not immediately helpful, however trying to remove the label via making a DELETE call to the /wiki/rest/api/content/<contentId>/label?name=10+10 endpoint returns the below:

      {
          "statusCode": 404,
          "data": {
              "authorized": false,
              "valid": true,
              "errors": [],
              "successful": false
          },
          "message": "com.atlassian.confluence.api.service.exceptions.NotFoundException: No label found with name: 10"
      }
      

      Workaround

      You are able to workaround this by adjusting the URL and replacing the offending + with %2B and making the DELETE call via REST eg.

      curl -X DELETE \
        -u <user_email>:<api_token> \
        -H 'Accept: application/json' \
        -H 'Accept-Encoding: gzip, deflate' \
        -H 'Content-Type: application/json' \
        'https://<siteName>.atlassian.net/wiki/rest/api/content/<contentId>/label?name=10%2B10'
      

      It's also possible to use the following code directly on the browser's console:

       fetch(
          "https://{instance}/wiki/rest/api/content/{content_id}/label/{label_name}",
          {
              "credentials":"include",
              "headers":{
                  "Content-Type": "application/json"
              },
              "method":"DELETE"
          }
      ).then((resp) => function(response){
          console.log(response);
      }); 

      Attachments

        Issue Links

          Activity

            People

              adildy@atlassian.com Andrew Dildy
              nwolfgang Battlebeard (Inactive)
              Votes:
              13 Vote for this issue
              Watchers:
              23 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: