There are 3 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-91878775-5ebf-4601-9509-1974e4070320 XWIKI-24534 In Progress

Cannot create pages if parent page ends with a dot

 
View issue   ·   Add comment
 

3 updates

 
cid:jira-generated-image-avatar-0818b4d8-f396-4053-bf9f-85a024bb90a0 Changes by Vincent Massol on 30/Jun/26 13:52
 
Priority: Major Critical
Status: Open In Progress
Labels: regression
 
 

1 comment

 
cid:jira-generated-image-avatar-0818b4d8-f396-4053-bf9f-85a024bb90a0 Vincent Massol on 30/Jun/26 13:52
 

Confirmed regression:

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.