This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-3fa40356-8c6f-49e5-a6e1-def72341cd48 XWIKI-22253 Open

Xar handler packager handles objects and attachments in translated documents as if they were in the original document (save, update)

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-28949f9a-d614-43fd-8539-abc64f8a3d90 Anca Luca created this issue on 12/Jun/24 14:19
 
Summary: Xar handler packager handles objects and attachments in translated documents as if they were in the original document (save, update)
Issue Type: cid:jira-generated-image-avatar-3fa40356-8c6f-49e5-a6e1-def72341cd48 Bug
Affects Versions: 15.10.10
Assignee: Unassigned
Components: Extension - XAR
Created: 12/Jun/24 14:19
Priority: cid:jira-generated-image-static-major-fd9bc097-55f3-45ce-8fc4-a90cf261a5bc Major
Reporter: Anca Luca
Description:

How to reproduce:

  • create a xar extension in which a page marked as a translation contains an object in the xml export of the page
  • install the extension

Expected result:

  • no object is created in the database, as objects cannot be attached to translated pages

Actual result:

  • an object is created in the database along with the translation page.

Now, having an object in the xml in the translated pages is not "correct" but there is nothing to validate it in the xar:format and, as this issue proves, nothing to stop it from being imported if present.

The use case described in this issue is rather simple and harmless, but when the extension is more complex, there are some undesired side effects of the fact that the xar handler is handling objects and attachments in translated pages, as if they were legitimate.

A good example is for the PublicationWorkflow contrib extension:

  • it has a translations page, Translations, which has an original document and 2 translations (fr and de)
  • in version 1.9.1.1, the 2 translations contained the XWiki.TranslationDocumentClass object, by mistake, as the original document did
  • in the latest version (2.3.2), these 2 objects were removed
  • when 1.9.1.1 is installed, the 3 objects from the 3 pages (original + translations) are handled, but there is no bad effect as the object is exactly the same and it overrides itself
  • upon upgrade to 2.3.2, if the translation pages are imported first by the extension manager, the following happens upon a translation page import:
    • extension manager loads previous version and finds it with an object inside - because it had one in the xar
    • then, it loads the next version and finds it without an object inside - because it doesn't have one anymore (it was fixed)
    • it compares the 2 and finds that an object was removed. Thus, it schedules the object for removal from storage. This removal removes the actual object from the original document, as per the current issue (objects are handled on translations as if they were on the original document)
  • then, when the original document is processed by EM, the situation is as follows:
    • previous document has an object inside
    • next document has an object inside
    • however, current document from the wiki does not have an object inside anymore (it was removed upon translations processing)
    • EM makes a merge and keeps the object deleted.
  • thus, the result here is that the object ends up being deleted upon upgrade of the extension.
 
 

2 updates

 
cid:jira-generated-image-avatar-28949f9a-d614-43fd-8539-abc64f8a3d90 Changes by Anca Luca on 12/Jun/24 14:21
 
Description: How to reproduce:
* create a xar extension in which a page marked as a translation contains an object in the xml export of the page
* install the extension

Expected result:
* no object is created in the database, as objects cannot be
attached associated to translated pages , only to the original page

Actual result:
* an object is created in the database along with the translation page.

Now, having an object in the xml in the translated pages is not "correct" but there is nothing to validate it in the xar:format and, as this issue proves, nothing to stop it from being imported if present.

The use case described in this issue is rather simple and harmless, but when the extension is more complex, there are some undesired side effects of the fact that the xar handler is handling objects and attachments in translated pages, as if they were legitimate.

A good example is for the PublicationWorkflow contrib extension:
* it has a translations page, Translations, which has an original document and 2 translations (fr and de)
* in version 1.9.1.1, the 2 translations contained the XWiki.TranslationDocumentClass object, by mistake, as
well as the original document did
* in the latest version (2.3.2), these 2 objects were removed
* when 1.9.1.1 is installed, the 3 objects from the 3 pages (original + translations) are handled, but there is no bad effect as the object is exactly the same and it overrides itself
, so the endresult is a single object in the database, which is what we expect
* upon upgrade to 2.3.2, if the translation pages are imported first by the extension manager, the following happens upon a translation page import:
** extension manager loads previous version and finds it with an object inside - because it had one in the xar
** then, it loads the next version and finds it without an object inside - because it doesn't have one anymore (it was fixed)
** it compares the 2 and finds that an object was removed. Thus, it schedules the object for removal from storage. This removal removes the actual object from the original document, as per the current issue (objects are handled on translations as if they were on the original document)
* then, when the original document is processed by EM, the situation is as follows:
** previous document has an object inside
** next document has an object inside
** however, current document from the wiki does not have an object inside anymore (it was removed upon translations processing)
** EM makes a merge and keeps the object deleted.
* thus, the result here is that the object ends up being deleted upon upgrade of the extension.


 
cid:jira-generated-image-avatar-459105da-d568-48ef-a179-790a62478c14 Changes by Thomas Mortagne on 12/Jun/24 14:25
 
Component: Old Core