Hyperlinks broken of contents

After updating the Plone version 5.0.4 for all hyperlinks of a given content it was broken, I wonder if it is possible to recover all these hyperlinks or have to retrieve them manually.

thanks in advance

1 Like

I am not sure that I understand "updating hyperlinks for a given content" correctly. I assume the hyperlinks are something in the ZODB. In this case, an "Undo" might reverse the change (Zope Management Page of your Portal --> Undo). There, you can undo recent transactions.

Should there already be too many transactions, "dm.historical" might of help. It allows you to get at the historical state of objects (i.e. at the state they had at a given time in the past) and potentiall to restore that state.

@dieter
I think you did not understand the problem I'm having, I will try to detail better.

I performed an upgrade from Plone 4.3.9 to 5.0.4, faced several problems that were treated this other topic: Problems after the migration of Plone 4.3.9 to 5.0.4

After solving the problems mentioned in the other topic I had the following problem, all Hyperlinks that was set up within the contents were broken, that is, when you click on them I'm not directed to the correct page. If I try to add a new external hyperlink, it does not work if I set as an internal hyperlink functions normally.

My question is if I can solve this problem all hyperlinks at once, or if I have to access each set content and hyperlinks contained in these contents one by one.

You are right.

That is strange: An external hyperlink is just a link. It should work (as most of it is handled by the browser alone with only minimal Plone contribution). There are two types of internal hyperlinks: one is a "normal" relative link to the object (something might have turned it even into an absolute link); another uses an uid and a general purpose url which resolves the uid to an object and then redirects to that object. The former should work as external links; the latter requires a correct mapping of uids to objects.
When you look of the HTML source of your page (--> in your browser, call for page source), how do the links look like (show us both working and failing links)?

This question might be answered once the problem is understood. Likely, a script might be developed that fixes all link problems - depending on how badly the internal structures have been broken.

Hyperlink working:

<a class="external-link" href="https://capri.brlink.com.br/base-de-conhecimento/artigos/zabbix/aws-monitoramento-rds-atraves-do-zabbix" target="_self" title="">aqui</a>

Hyperlink broken:

<a title="" href="https://capri.brlink.com.br/../../procedimentos/p0019-4-setup-de-backups-de-vms-diarios" class="external-link" target="_self">Link procedimento</a>

As can be seen in the examples above, the broken Hyperlinks are pointing to a nonexistent link.

I do not know if it was clear, but if you are still in doubt to understand my problem tell me.

may be related with: https://github.com/plone/plone.app.layout/pull/33/files

I suppose this is a bug in Plone 5(.0.1). Apparently, relative external links are not handled correctly: some magic prepends an "http://" which some browsers (at least my Firefox) do not resolve relative to the base url and do not understand.
In your case (Plone 5.0.4) the prefix even seems to be "http://" which is even more wrong.

Apparently, you are (a bit) abusing "external links". An external link is mainly meant to link to foreign targets (those outside your site) and then typically use an absolute url. Apparently, someone thought that an external link could also be used to link to targets in the current site and therefore has allowed relative urls as well - but this special case seems not to have been well tested and seems to be currently broken.

You may need to get this bug fixed before a migration has a good chance to get correct external links to internal targets. For newly created links use "internal links" to link to internal targets.

I recommend to file a bug report.

@dieter
You have many set Hyperlinks, would somehow alter them External URL to Internal automated way?
Does this bug will be fixed in next patch update?

Likely.

The best chance might provide the internal data structures of "plone.app.linkintegrity" if it supports external links (as well as internal ones). Then, they would allow you to find all content objects containing links and turn the external links which really are internal ones into internal ones.

Otherwise, you would need to visit all "page" objects, look whether they contains links to be converted and do it.

A likely precondition is that the bug gets officially (i.e. in the Plone bug tracker) reported. Will you do the reporting?

@dieter
Thank you for the support, but just doing it manually.