[MGNLDAM-518] MoveContentToDamMigrationTask creates path conflicts in DAM Created: 13/Oct/14  Updated: 29/Jun/18  Resolved: 27/Oct/14

Status: Closed
Project: Magnolia DAM Module
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.5

Type: Bug Priority: Neutral
Reporter: Samuel Zihlmann Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Visible to:
Peter Mohn

 Description   

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.


Generated at Mon Feb 12 05:00:38 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.