[MAGNOLIA-8273] Let Magnolia be more forgiving with leading and trailing spaces in node names Created: 24/Dec/21  Updated: 13/Jan/22  Resolved: 30/Dec/21

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.14
Fix Version/s: 6.2.16

Type: Bug Priority: Neutral
Reporter: Federico Grilli Assignee: Yen Lac Tue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 2d 6h 55m
Original Estimate: Not Specified

Attachments: PNG File Screenshot 2020-05-15 at 16.42.29.png    
Issue Links:
Cloners
clones PAGES-410 Let Magnolia be more forgiving with l... Closed
Problem/Incident
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: Pages Maintenance 3, Pages Maintenance 4
Story Points: 2

 Description   

To reproduce

  • create a new page by choosing a name led by a whitespace
  • Magnolia throws the runtime exception below

Caused by: org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: ' a space precedes this name' is not a valid path. ' ' not valid name start
	at org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:392) ~[jackrabbit-spi-commons-2.20.0.jar:?]
[...]
	at info.magnolia.jcr.util.NodeNameHelper.getUniqueName(NodeNameHelper.java:127) ~[magnolia-core-6.2.1-SNAPSHOT.jar:?]
	at 
[...]
info.magnolia.pages.app.action.browser.CreatePageAction.execute(CreatePageAction.java:92) ~[magnolia-pages-app-6.2.1-SNAPSHOT.jar:?]

I guess Magnolia could be more forgiving by trimming leading and trailing spaces or NodeNameHelper.getUniqueName(..) could replace them with - character as it does with in name whitespaces.


Generated at Mon Feb 12 04:31:12 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.