Root cause (confirmed regression). XWIKI-24031 (commit aabab613515, "Unexpected path when
using partial reference in parent field of Create", landed in 17.10.4 / 18.2.0RC1) added a
client-side live validation to the space-reference field in
xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/widgets/locationPicker.js
(around line 401):
let dotRegex = /(^\.)|(\.$)|(\.\.+)/
spaceValidator.add(Validate.Custom, {
failureMessage: l10n['core.validation.spacevalidation.message.invalidreference'],
against: function(value) {
if (typeof value === 'string') {
return value.strip().search(dotRegex) === -1;
} else {
return true;
}
}
});
The intent was to reject partial references typed by the user — a leading dot, a trailing dot
or doubled dots produce empty path segments (.Foo.Bar, Foo., Foo..Bar).
The problem: the parent field is auto-populated with a serialized local space reference
(via XWiki.Model.serialize — see locationPicker.js:120 — and server-side
$services.model.serialize(... , 'local') in createinline.vm:394). XWiki reference
serialization escapes a dot inside a name with a backslash (verified in
uicomponents/model/entityReference.js, SPACESEP='.', ESCAPE='\'). So a space literally
named 1. is serialized as 1\.. The naive regex (\.$) then matches the trailing (escaped)
dot and falsely flags the reference as invalid. The dot here is part of a name, not a separator.
This is a regression: before XWIKI-24031 (≤ 17.10.3) no such validation existed and creating
subpages under dot-ending parents worked.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.