This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-b6a3a275-902c-4e65-96b7-873fe80628ec XWIKI-25068 Open

Wiki skin files are corrupted when processed as wiki syntax (e.g. when renaming a page they reference)

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-eb0fd271-800a-4adb-bddd-2ff57a6f6da2 Vincent Massol created this issue on 01/Oct/26 13:00
 
Summary: Wiki skin files are corrupted when processed as wiki syntax (e.g. when renaming a page they reference)
Issue Type: cid:jira-generated-image-avatar-b6a3a275-902c-4e65-96b7-873fe80628ec Bug
Affects Versions: 17.10.13
Assignee: Unassigned
Components: Skin
Created: 01/Oct/26 13:00
Priority: cid:jira-generated-image-static-major-b53f7a83-2aa7-476d-b3e8-cf86029c8328 Major
Reporter: Vincent Massol
Description:

Problem

The content of wiki skin files (the content property of XWiki.XWikiSkinFileOverrideClass objects, and the style.css, header.vm, footer.vm, viewheader.vm, view.vm and edit.vm properties of XWiki.XWikiSkins objects) gets corrupted whenever some code processes the wiki content of the document's xobjects: the whole file is parsed as xwiki/2.1 and rendered back as xwiki/2.1, which breaks the Velocity/CSS code and thus the skin.

For example, the standard htmlheader.vm lines:

    ## ---------------------------------------------------------------------------------------------------------------
    ## Ensure that the Content-Type meta directive is the first one in the header.
    ## See http://www.w3.org/International/tutorials/tutorial-char-enc/
    ## ---------------------------------------------------------------------------------------------------------------
    <meta http-equiv="Content-Type" content="text/html; charset=$xwiki.encoding" />
    ## ---------------------------------------------------------------------------------------------------------------
    ## Compute the title.
    ## ---------------------------------------------------------------------------------------------------------------

become:

    ## ---
    --##-- Ensure that the Content-Type meta directive is the first one in the header.
    ## See http://www.w3.org/International/tutorials/tutorial-char-enc/
    ## ---
    <meta http-equiv="Content-Type" content="text/html; charset=$xwiki.encoding" />
    ## ---
    --##-- Compute the title.
    ## ##--##-

(other lines get merged, e.g. ...action")##, or ##
##
).

Steps to reproduce

  1. Create a page Sandbox.ReproTarget
  2. Create a page Sandbox.SkinRepro with an XWiki.XWikiSkinFileOverrideClass object having path = htmlheader.vm and content = the standard htmlheader.vm template plus the line ## Help: [[Sandbox.ReproTarget]]
  3. Rename Sandbox.ReproTarget (keeping the default "update links" option)

Expected: the skin file is left untouched (it's Velocity code, not wiki content).

Actual: Sandbox.SkinRepro gets a new version with the comment "Renamed back-links." and its content is corrupted as shown above.

Another way to reproduce: install the org.xwiki.contrib:listener-urlnormalizer-api extension and save a skin file override whose content contains an absolute URL pointing to the wiki itself: the content is corrupted on save.

Cause

These properties are created by BaseClass#addTemplateField(), which sets the PureText editor but no content type. An empty content type means "wiki text" (TextAreaClass#getContentType()), so TextAreaClass#isWikiContent() returns true for them and any code handling the wiki content of xobjects (link indexing, link refactoring on rename/move, syntax conversion, extensions such as the URL normalizer) treats skin files as wiki content.

Workaround

In the class editor of XWiki.XWikiSkinFileOverrideClass (and XWiki.XWikiSkins), set the "Content Type" of these properties to "Plain Text".

 
 

4 updates

 
cid:jira-generated-image-avatar-eb0fd271-800a-4adb-bddd-2ff57a6f6da2 Changes by Vincent Massol on 01/Oct/26 13:00
 
Fix Version: 17.10.14
Fix Version: 18.9.0-rc-1
Fix Version: 18.4.7
Assignee: Vincent Massol