Rename/Move-broken image

Hello,

Each time we rename or move a page the images appear as a small broken icon.

Thanks in advance.

Kind regards,
Wakeel

The images can have relative or absolute paths. Examples can be seen at https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/?syntax=2.1&section=Images

When you add an image (by WYSIWYG upload) and then rename it, you will have the following syntax [[image:PageA.PageB@img.png]]. In theory, when doing the copy / move the references should be updated according to the new page, but in some cases the process is broken and the reference is the old page, that doesn’t exist anymore. This needs to be reported as bug.

Until this is fixed, you could try to manually fix the path to a relative one (attachment on current page), example: [[image:img.png]].

Actually it might not be a bug, since by default the the “Update links” option is checked.
updatelinks

So the solution is to uncheck the “Update links” option in order to preserve the relative paths for images. But this might affect the page links.
links
It pretty much depends on your content, check how many “incoming links” you have.

Related issue:

Still, @wakeel you should still report the issue with the images example and mentioning the expected behavior. Please provide more details if your pages also contain other types of links (like pages). IMO we should make a special case for relative attached images and use the new reference instead.

Hi Evalica,

Thanks for the reply.

This is a test I just made (the option update link is no present :frowning: ) using WYSIWYG
image

image

Trying to move page (same issue with rename)

image

image

Kind regards,
Wakeel

I’ve reported the issue at https://jira.xwiki.org/browse/XWIKI-16446

Hi,

due to this issue we have multiple spaces which right now would need fixing by hand. That could take days. Is there a good way to automate this? All references attachements/images are on the same page (i.e. no cross references between pages) so I guess that there could be an attempt to migrate this automatically. Is there?

Best regards,
Johannes

What I can think of to fix this is a script doing the following:

  • get all the pages containing attachments
  • for each page, get the attachment link and image blocks
  • for each block, if the target attachment exit in the page change the reference to a local reference (only keep the attachment name)
  • save the page if a modification was made