# Copying and revision history of Attachments

**URL:** <https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528>\
**Category:** Help / Discuss\
**Tags:** attachments, xwiki\
**Created:** [February 21, 2025, 12:19pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528 "2025-02-21T12:19:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 21, 2025, 12:19pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/1 "2025-02-21T12:19:56Z")

</div>

Hello,

I’ve recently migrated an old XWiki (8.4.5 IIRC, WAR deployment) from an old Windows server to a new Linux machine and upgraded XWiki to 16.10.3 LTS, Tomcat to 9 with Java 17, Postgres to 16 and placed it behind an Nginx.

I’ve gone through all the release notes several months ago in preparation for the migration, but I don’t remember specifics anymore. I’ve stumbled on some errors with the new XWiki, one of which is CKEditor crashing with a vague and unhelpful “Internal error” and losing data, which prompted me to disable xwiki-realtime plugin.

However, my current main issue is with copying pages. In the old XWiki, when copying a page with all its children and attachments, the copied attachments retain their revision history, original author and original upload date. This is not the case with the new XWiki. Instead what happens is all this is rewritten with the user who’s performing the copying. I.e. attachments lose revision history, the original author is overwritten with the author who’s performing the copying action and the upload date is set to the current date and time. In my case, this is not a desired behaviour. Is it possible to revert to the old behaviour where all this is retained?

One other thing is error handling. For instance, I have a user who is trying to copy a page with its children, but there’s always a page missing, and the process finishes with a yellow warning about errors. If I do it with my Administrator account, the process finishes successfully, but even if it doesn’t, there is an active log I can read on the copy page. This is missing for the regular, non-admin user, which makes troubleshooting difficult. Is there any way to enable this log for normal users? Or at least a log somewhere I as an admin can find and use for troubleshooting?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![MichaelHamann](https://forum.xwiki.org/user_avatar/forum.xwiki.org/michaelhamann/32/3813_2.png) [@MichaelHamann](https://forum.xwiki.org/u/MichaelHamann)\
**Post date:** [February 21, 2025, 4:11pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/2 "2025-02-21T16:11:36Z")

</div>

> [@temp](#):
>
> Is there any way to enable this log for normal users?

I think by default we only display the log for advanced users, so setting the user type of the normal user as advanced should help.

I unfortunately don’t know more about the other issues you encountered.

---

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 24, 2025, 2:46pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/3 "2025-02-24T14:46:50Z")

</div>

Thanks, setting the user to Advanced enabled the log preview.

* * *

Regarding the copying issue, here is a screenshot of XWiki LTS 16.10.3 to clarify my exact problem.

 ![Screenshot 2025-02-24 145019](https://forum.xwiki.org/uploads/default/original/2X/e/ee4f59c049d531adcab4acbd3a474c45f6e996bb.png)

You can see revision history is lost, the date is changed to the time the page was copied and the author of the attachment is changed to the user performing the copying action. The “hacky” workaround - which I’m not too fond of - is to go into page history and revert it to the state before it was copied. That (mostly) reverts the changes to reflect the original page’s attachment data.

The behavior on XWiki 8.4.3 is different. If I copy the page with all its children, the attachment data is preserved. The only difference I’ve noticed is the new XWiki switched the attachment list to LiveData, and I’m guessing this is where the discrepancy in behavior is.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [February 24, 2025, 3:06pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/4 "2025-02-24T15:06:29Z")

</div>

I cannot reproduce this attachment history loss problem on XWiki 16.10.3.

Are reproducing this attachment revision loss when copying a page created with XWiki 8.4.3, or a new page that you then move ?

The default store for attachments content changed in XWiki 11.0 (database → filesystem) and I’m wondering if we have on bug related to moving attachments from one store to the other.

---

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 24, 2025, 3:26pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/5 "2025-02-24T15:26:04Z")

</div>

I’m not sure if it’s a typo, but this is XWiki **16**.10.3.

Let’s say I have a page with multiple subpages. Several of these subpages have attachments. In the old XWiki 8.4.3 if I copy one of these subpages, the behavior is that attachments retain their original metadata. I.e. the revisions would still be there, the date would reflect the date of the last revision/upload and author would be the last user who uploaded the file. In this case, 8 revisions, last one on 2025/01/14 by John Doe.

Here is an example of a copied page with attachments retaining the metadata of the original page in XWiki 8.4.3:

 ![Screenshot 2025-02-24 161735](https://forum.xwiki.org/uploads/default/original/2X/5/5b6760394277232b66a6551f93a920ef8244ca13.png)

The original page and its attachments remain in place, nothing is moved, just copied.

Meanwhile, the behavior of XWiki 16.10.3 is that the copied attachments on the copied page lose this metadata and revision history, as you can see in the screenshot from my previous message

> Are reproducing this attachment revision loss when copying a page created with XWiki 8.4.3, or a new page that you then move?

Doesn’t matter. The behavior is the same whether the page and the attachments were created on the old XWiki version or the new one.

> The default store for attachments content changed in XWiki 11.0 (database → filesystem) and I’m wondering if we have on bug related to moving attachments from one store to the other.

Yes, I’m aware. Our XWiki 8.4.3 was set to save attachments on filesystem through xwiki.cfg file.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [February 24, 2025, 3:37pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/6 "2025-02-24T15:37:20Z")

</div>

> [@temp](#):
>
> I’m not sure if it’s a typo, but this is XWiki **16**.10.3.

It was a typo indeed. Sorry about that.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [February 24, 2025, 3:38pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/7 "2025-02-24T15:38:30Z")

</div>

> [@temp](#):
>
> Our XWiki 8.4.3 was set to save attachments on filesystem through xwiki.cfg file.

And what do you have in xwiki.cfg now ? Have you reverted your customization ? The way to configure the attachment content storage changed a bit since 8.4.3.

---

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 24, 2025, 3:42pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/8 "2025-02-24T15:42:10Z")

</div>

I checked the config, I think this is the relevant part:

```auto
# xwiki.store.recyclebin.content.hint=file
#-# The attachment content storage.

xwiki.store.attachment.hint=file

#-# The attachment versioning storage. Use 'void' to disable attachment versioning.

xwiki.store.attachment.versioning.hint=file

#-# [Since 9.9RC1] The default attachment content recycle bin storage.
#-# This property is only taken into account when deleting an attachment and has no effect on already deleted documents.

xwiki.store.attachment.recyclebin.content.hint=file

```

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [February 24, 2025, 4:01pm UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/9 "2025-02-24T16:01:11Z")

</div>

> [@temp](#):
>
> I checked the config, I think this is the relevant part:
> 
> ```auto
> # xwiki.store.recyclebin.content.hint=file
> #-# The attachment content storage.
> 
> xwiki.store.attachment.hint=file
> 
> #-# The attachment versioning storage. Use 'void' to disable attachment versioning.
> 
> xwiki.store.attachment.versioning.hint=file
> 
> #-# [Since 9.9RC1] The default attachment content recycle bin storage.
> #-# This property is only taken into account when deleting an attachment and has no effect on already deleted documents.
> 
> xwiki.store.attachment.recyclebin.content.hint=file
> 
> ```

Looks OK, but you should comment them since it’s the default already (better really set what you need in xwiki.cfg, makes much easier to merge during upgrades).

> [@temp](#):
>
> copied attachments

I kept thinking about rename (which is apparently working fine) so that’s what I tested. I confirm that I reproduce the same regression with copy (strangely, since rename is copy+delete from storage point of view).

Created [XWIKI-22927](https://jira.xwiki.org/browse/XWIKI-22927).

---

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 25, 2025, 9:14am UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/10 "2025-02-25T09:14:03Z")

</div>

Awesome. Is the fix going to be ported to the (next) LTS minor release, too?

* * *

I’ve got another question regarding attachments. When right-clicking on the attachment filename and copying the link, it looks like this:

`https://xwiki.example.com/wiki/subwiki/download/Page1/Subpage1/WebHome/document.docx?rev=1.2`

I’ve noticed that this link always points to the latest version of the document, even if I change the revision number in the link, and even if it’s a non-existent revision number. For instance, let’s say there is the original attachment and one revision. I get the same outcome if I replace `rev=1.2` with `rev=1.1` and `rev=1.9`. I.e. it links to the latest version of the attachment, which is `rev=1.2`. Why is `?rev=##` included when changing the number or entirely removing that part points to the latest document either way? Is this expected behavior?

If I wanted a specific revision, I’d have to click on the superscript revision number and choose there anyway, since the path is different then, `.../download/...` vs `.../downloadrev/...`:

`https://xwiki.example.com/wiki/subwiki/downloadrev/Page1/Subpage1/WebHome/document.docx?rev=1.1`

This link correctly produces path to the revision 1.1.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [February 25, 2025, 9:49am UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/11 "2025-02-25T09:49:01Z")

</div>

> [@temp](#):
>
> Is the fix going to be ported to the (next) LTS minor release, too?

It definitely should.

> [@temp](#):
>
> Why is `?rev=##` included when changing the number or entirely removing that part points to the latest document either way? Is this expected behavior?

The goal of that URL was not so much to point to a specific version of the attachment, but to make sure the URL is different (to avoid browser cache problems).

---

<div class="post-metadata">

**Author:** ![temp](https://forum.xwiki.org/user_avatar/forum.xwiki.org/temp/32/9215_2.png) [@temp](https://forum.xwiki.org/u/temp)\
**Post date:** [February 25, 2025, 9:51am UTC](https://forum.xwiki.org/t/copying-and-revision-history-of-attachments/16528/12 "2025-02-25T09:51:23Z")

</div>

Okay, thanks for clarifying. I just needed to confirm it’s expected behavior, so I can pass the information along.
