1. Problem: naming frenzy
- DAM assets have 3–4 names "attributes", only initially deduced from one
- We keep trying to keep them in sync from all sorts of different ends
- Those name attributes have different constraints
- Upload, zip upload, import, rename, duplicate, copy-pasta... all behave slightly differently
Name attributes & constraints
- node name
- cannot contain JCR-illegal characters
- cannot contain URI-illegal characters due to URI2RepositoryMappings
- the latter (consumer) should probably do the URI-safety job instead of forcing itself onto JCR
- asset name (property)
- friendly "display name" without the file extension
- may contain JCR-illegal characters
- underlying jcr:content node > fileName property
- strictly faithful to the uploaded file name
- underlying jcr:content node > extension property
- may or may not exist
DAM 2.x Canonical structure
- master-with-spaces.png [mgnl:asset]
- name: "master with spaces"
- jcr:content [mgnl:resource]
- extension: "png"
- fileName: "master with spaces.png"
Past conventions and deviations
- in dam 1.x, extension was stripped from fileName, hence in node name as well
- in dam 2.0, extension was kept if fileName, but still stripped from node name
- MGNLDAM-428 - Getting issue details... STATUS
- inconsistent behavior between upload & zip upload; one of them preserved the extension in node name
- in dam 2.0.2, this inconsistency was lifted
- MGNLDAM-483 - Getting issue details... STATUS
- for some reason, many travel-demo assets contain the extension everywhere (incl. in the asset name prop)
2. Effect of actions
Action | As of DAM 2.2 | Proposed |
---|---|---|
Upload & Zip Upload |
|
|
Duplication (CreateAssetVariantAction) |
| |
Copy & Paste |
| |
Rename |
|
|
Import |
| - |
3. Ideas & Proposals
- Unified naming process based on fileName (see table above)
- Split unique naming constraint vs. bound properties (aka pre-save sync operations)
- On (content) naming strategy:
- Each content-type should decide what naming strategy to use (case-sensitivity, illegal chars...)
- Whole concept spans much further than just DAM (more on another concept eventually)
- users workspaces would be another example
- ... but could be tested/implemented in DAM first
- Inject naming strategy instead of calling
Path#getValidated/UniqueLabel
in different ways everywhere - How about strategy providing the raw "next available index"—for application to naming attributes in different ways
- Bound properties // pre-save sync operations
- Should be abstracted away from actions—dev shouldn't have to do/call anything
- Could/should be done on session level,
ContentDecorators
to the rescue - Support for locking dynamically bound properties together vs. unlocking?
- On (content) naming strategy:
- Ditch the asset name property
- —use column formatter instead to do the extension trim
- Stop considering spaces illegal in JCR, they're not
- —worth an update to
info.magnolia.cms.core.Path#getValidatedLabel
- —worth an update to
Side notes
- Asset title is barely used
- Original idea for asset variants was NOT to duplicate the binary unless modified
- speaks for leaving fileName untouched
- copy-paste should ALSO create a variant
- What are suffixes for in the first place?
- avoid JCR same-name siblings
- give user a visible differentiator
- We keep zip extension on directory for zip upload—doesn't make much sense
- We never display confirmation dialogs upon conflicting pastes/renames
Resources
- DAM workspace structure
- MGNLDAM-428 - Getting issue details... STATUS
- MGNLDAM-458 - Getting issue details... STATUS
- MGNLDAM-483 - Getting issue details... STATUS
- MGNLDAM-529 - Getting issue details... STATUS
- MGNLDAM-589 - Getting issue details... STATUS
- MGNLDAM-658 - Getting issue details... STATUS
- MGNLDAM-665 - Getting issue details... STATUS
- MGNLDAM-678 - Getting issue details... STATUS
Overview
Content Tools
Apps
Activity