Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-21843

REST API allows setting dates with five digit year, causing UI issues in Share

    Details

    • Type: Service Pack Request
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 6.2
    • Fix Version/s: 6.2.N
    • Component/s: ACS REST API
    • Labels:
      None

      Description

      Description
      When creating a node via the REST API, it's possible to set a date with a 5-digit year (e.g. 20202-09-02) for date properties. This causes an error pop-up and UI issues in Share and is inconsistent with creating a node via the UI where a date like this is flagged as invalid.

      Steps to reproduce

      • Create a new node via the REST API, sending a POST request for example to

      http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children

      with the following data:

      {
          "name":"WrongDate",
          "nodeType":"cm:content",
          "properties": {
              "cm:created": "20202-09-02"
          }
      }
      

      (Note: The observed behavior is the same whether the cm:created property or a custom date property is set to a value like this. cm:created is suggested to test this without the need for adding a custom property to the content model)

      • Inspect the created node in Share and in the Node Browser

      Expected Behaviour
      The REST API should return an error instead of creating the node, consistent with Share where the property value will not be saved when a date in this format is entered (see attached screenshot "share_error.png")

      Observed Behaviour
      The node is created with the created date set to the year 20202, this value can be seen in the Node Browser and database (see attached screenshot "NodeBrowser.png").
      When opening the document in Share, there is a pop-up saying "Failure" and none of the properties of the node are displayed (see attachments "Failure_popup.png" and "properties.png"). The share.log file shows an error similar to "Failed to parse date 20201-08-27T00:00:00.000+01:00" (see attached).

        Attachments

        1. Failure_popup.png
          Failure_popup.png
          4 kB
        2. nodeBrowser.png
          nodeBrowser.png
          124 kB
        3. properties.png
          properties.png
          6 kB
        4. share_error.png
          share_error.png
          4 kB
        5. share.log
          41 kB

          Structure

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ewetchy Elisabeth Wetchy
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Structure Helper Panel