Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-736

File renaming not persisted in node's name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Neutral Neutral
    • None
    • 2.3
    • None

      When editing an asset replacing the media file with another one with different name, corresponding JCR node is not renamed accordingly and, as a consequence, file can not be accessed through a link pointing to the new renamed file.

      This is happening due to the condition of being a new Node that is checked at the very beginning of setNodeName method in SaveAssetFormAction class:

      info.magnolia.dam.app.assets.form.action.SaveAssetFormAction
      @Override
          protected void setNodeName(Node assetNode, JcrNodeAdapter item) throws RepositoryException {
      
              if (item instanceof JcrNewNodeAdapter) {
                  // Get File Name
                  Node resourceNode = AssetNodeTypes.AssetResource.getResourceNodeFromAsset(assetNode);
                  String fileName = extractFileName(resourceNode);
      
                  if (StringUtils.isNotBlank(fileName)) {
                      setAssetPropertyName(item, assetNode, fileName);
                      // set the node name
                      String newNodeName = generateUniqueNodeNameForAsset(assetNode, fileName);
      
                      item.setNodeName(newNodeName);
                      NodeUtil.renameNode(assetNode, newNodeName);
                  }
              }
          }
      

      See linked support ticket for more details about the issue.

        Acceptance criteria

              Unassigned Unassigned
              jayala Jonathan Ayala
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD