Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-20558

Inserting a text that contains a colon which is positioned after 256 characters within square brackets causes System Error page

    XMLWordPrintable

Details

    • Bug
    • Resolution: Answered
    • Low
    • None
    • 3.0.2, 3.2.1, 3.3
    • None

    Description

      Steps to reproduce:
      1. Create a page
      2. Insert the following text in Rich-Text Editor:
        [this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. this is 256 character. thissssss is 256 character:test123]
        
      3. Save the page
      4. User will get a System Error page with the following error:
        org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.links.OutgoingLink#4784133]; SQL []; Data truncation: Data too long for column 'DESTSPACEKEY' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'DESTSPACEKEY' at row 1
            at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:110)
        
        caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'DESTSPACEKEY' at row 1
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3561)
        
      Workaround
      1. Add a space after the opening square bracket '[' or before the closing square bracket '['
        or,
      2. Replace the colon ':' with:
        :
        

        or,

      3. Insert the text inside Noformat Macro or Code Block Macro.
      Findings

      I think this happens because Rich-Text Editor will take square brackets '[ ]' as a link. So any characters before the colon ':' within the square brackets '[ ]' will be considered as a Space Key. If there are more than 255 characters for that part - ie. before colon ':' within the square brackets '[ ]', this will cause an error because DESTSPACEKEY column in LINKS table can only hold 255 characters value as shown below:

      mysql> desc links;
      +---------------+--------------+------+-----+---------+-------+
      | Field         | Type         | Null | Key | Default | Extra |
      +---------------+--------------+------+-----+---------+-------+
      | LINKID        | bigint(20)   | NO   | PRI | NULL    |       |
      | DESTPAGETITLE | varchar(255) | YES  |     | NULL    |       |
      | DESTSPACEKEY  | varchar(255) | NO   | MUL | NULL    |       |
      | CONTENTID     | bigint(20)   | NO   | MUL | NULL    |       |
      | CREATOR       | varchar(255) | YES  |     | NULL    |       |
      | CREATIONDATE  | datetime     | YES  |     | NULL    |       |
      | LASTMODIFIER  | varchar(255) | YES  |     | NULL    |       |
      | LASTMODDATE   | datetime     | YES  |     | NULL    |       |
      +---------------+--------------+------+-----+---------+-------+
      

      This bug has been tested in MySQL, Postgre and SQL Server. But it seems to be not an issue in HSQL.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              halatas HuseinA
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: