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

javascript API copy() function does not work as documented as it copies children, and copies are broken too

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 3.1.2
    • Fix Version/s: 3.2.1
    • Component/s: Installer
    • Labels:
      None
    • Environment:
      3.1sp2
    • Bug Priority:
      Category 2
    • ACT Numbers:

      16664

      Description

      javascript API copy() function does not work as documented as it copies children, and copies are broken too.
      Web UI behaviour not consistent with CIFS behaviour.

      How to reproduce?
      ===================

      1) on a fresh 3.1sp2 alfresco, in company home create two folders:
      folder1
      folder2
      one subfolder 'sub1' under 'folder1' and put a test file with 'sub1'

      2) create a javascript 'alex_test1.js' file which contains:

      ------
      var source = companyhome.childByNamePath("folder1");
      var destination = companyhome.childByNamePath("folder2");
      copied = source.copy(destination);
      copied.save();
      -------
      (file attached)

      upload it to "Company Home > Data Dictionary > Scripts"
      and run it calling the URL:

      http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company Home/Data Dictionary/Scripts/alex_test1.js

      3) in 'folder1', delete the subfolder 'sub1' (This space and all its contents) using the web UI

      4) now try to browse 'folder2'

      Results:
      ========

      A) With the web UI:
      --------------------

      browsing 'folder2' and going to

      folder2/folder1

      with the web UI, you can see 'sub1' but clicking on it raise an error:

      Unable to find the repository item referenced by Id: 577fce57-97d3-414a-857e-e5ff1c976113 - the record has probably been deleted from the database.

      B) With CIFS
      -------------

      however, if you mount alfresco by cifs:

      mount -t cifs -o username=admin,password=admin //localhost/alfresco /mnt/

      you can still access 'sub1':

      ls -1 /mnt/folder2/folder1/sub1
      __AlfrescoCmd.exe
      __AlfrescoEcho.exe
      __AlfrescoScript.exe
      __Alfresco.url
      __AlfrescoURL.exe
      __CheckInOut.exe
      repro.txt
      __ShowDetails.exe

      Conclusion:
      ============

      I raise this as a bug as
      1) CIFS and Web UI behaviour is NOT consistent: one can see a sub folder using one protcol but not the other

      2) The copy() behaviour does not seem to follow the API documentation at:

      http://wiki.alfresco.com/wiki/3.1_JavaScript_API

      -------------
      ScriptNode copy(ScriptNode destination)
      Copies the node to the specified destination node. The newly copied ScriptNode instance is returned on success or null is returned if the copy fails reason. Note that children of the source node are not copied.
      -------------
      as here the children seem to be copied (and in fact they are half copied).

      Other tests done:
      =================
      A similar test made with the other API fonction "copy(ScriptNode destination, boolean deepCopy)" where deepCopy is 'true' works as expected.

      Other versions:
      ================
      Support also tested with 3.2sp1 and the issue does not appear anymore:
      the children are NOT copied anymore, as described in the documentation.

      Notes:
      ======
      a search in Jira for the error message linked to:
      https://issues.alfresco.com/jira/browse/ALF-283

        Attachments

        1. alex_test1.js
          0.2 kB
        2. alex_test2.js
          0.2 kB
        3. click_sub1.png
          click_sub1.png
          109 kB

          Structure

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs
                Reporter:
                amadon Alex Madon [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Structure Helper Panel