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

MoveContentToDamMigrationTask creates path conflicts in DAM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 2.0.5
    • None
    • None

      Uploaded files with the same filename but different binary node names (e.g. if in different languages "binaryNodeName_de" "binaryNodeName_fr") are now stored on the same path in DAM -> so all but one file cannot be migrated

      Log:

      Line 167: 2014-10-08 16:14:22,961 WARN info.magnolia.dam.app.setup.migration.MoveContentToDamMigrationTask - '/moved_uploaded/home/.../content/01/teasers/0' path already exists in dam repository. Uploaded file will not be migrated '/home/.../content/01/teasers/0'

      I fixed this issue in this way (MoveContentToDamMigrationTask):

          protected String copyToDam(final Node dataNodeResource) throws RepositoryException {
      
              String nodeIdentifier = "";
              final String binaryPath = dataNodeResource.getPath();
              final String fileName = createFileName(dataNodeResource);
              // Check
              if (this.damUploadedRootNode.hasNode(binaryPath.replaceFirst("/", "") + "/" + fileName)) {
                  final String targetPath = this.damUploadedRootNode.getPath() + "/" + binaryPath;
                  log.warn("'{}' path already exists in dam repository. Uploaded file will not be migrated '{}'", targetPath, binaryPath);
                  return null;
              }
      
              // Create an AssetNode
              final Node assetNode = createAssetNodeAndSubFolder(this.damUploadedRootNode, binaryPath, fileName);
              nodeIdentifier = assetNode.getIdentifier();
              updateAssetProperty(assetNode, dataNodeResource);
              // Create resource Node
              final Node assetNodeResource = assetNode.addNode(AssetNodeTypes.AssetResource.RESOURCE_NAME, AssetNodeTypes.AssetResource.NAME);
              updateResourceProperty(assetNodeResource, dataNodeResource);
      
              // Save
              this.damSession.save();
      
              return nodeIdentifier;
          }
      

      This should be fixed.

        Acceptance criteria

              fgrilli Federico Grilli
              szihlmann Samuel Zihlmann
              Peter Mohn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD