Ticket #8144 (assigned Bug)

Opened 4 years ago

Last modified 5 weeks ago

Internal links in static text portlet become incorrect in display context

Reported by: planakim Owned by: arrowman
Priority: major Milestone: 3.3.x
Component: Infrastructure Version:
Keywords: porlet link relative Cc: thijs

Description

Because kupu rewrites any link found to be internal on the site to a relative link and because a static portlet will often be made to be shown in several different direvtories the links will end up pointing to the wrong place.

Steps to reproduce:

1) create a page called test.

2)create a static portlet and make a link to the page called test in the portlet

3)make a folder (subdirectory to where you are)

4) go to the new folder

5) click on the link in the porlet - it will give an error as in the subdir the link will point to the wrong place

What aggravates the situation is:

a) couple will rewrite links to relative even if you create it using the external link button. b) kupu does this too even if you in html view manually make the path relative to the root of the site ( ie /foldername/documentname will be rewritten to ../documentname or whatever the file is

Suggestion to solve (in order of preference):

a) make kupu not mess with external links and rename the button to "absolute link" or such (change of name not vital but I guess more correct)

b) make a new third button (absolute link) and make kupu not mess with links created using that one

c) make the edit without visual editor link that once was there be there again(though somewhere in the list of corrected errors it appears 1.4.9 fixed this it is still not possible on several plone 3.0.5, 3.0.6 and 3.1.1 sites) and work (for some reason with portlets manually entering the parameter ?I-forgot=whatever that turns kupu off does also not work for me on portlets though that works on "normal content")

d) make it an option somewhere to turn off the "smart rewrite of links" logic in kupu

e) remove kupu as editor for static portlets (go back to how it was before it was included in core).

Even e is still far preferable to the current state of affairs where static portlets that link to something on ones site just cannot be made to work if the portlet has to be shown in more than one location.

Change History

comment:1 Changed 4 years ago by duncan

'not messing with links' isn't really an option. The browsers (especially IE) mess with the links and kupu then just makes sure you get consistency between different browsers.

I'd suggest another option which would be for the static portlet to convert relative links to base relative based on the location of the content it is rendering. That ought to be a fairly minimal change to the static portlet.

comment:2 Changed 3 years ago by thijs

  • Owner duncan deleted
  • Cc thijs added
  • Component changed from Visual Editor (Kupu) to Unknown

Is there any folow up on this issue? This causes all the internal links in Static Text portlets inside folders to be incorrect.

I've created page on the top level with a Static text portlet linking to this page. And created a folder named test-folder. (basically the described steps 1, 2 and 3) After that I've copied the test page with the portlet into the folder.

The link should lead to the top page named test, but it does not and will always lead to the page called test that was copied in the folder. It is not possible to make it go to the top one in any way!

All the internal links created in the static text portlet in the folder will start with portal_url/test-folder/ and then the url that should start from portal_url.

Traversal will generally lead you to the right page when clicking the link because most pages have unique id's but if there are identical id's in a site. It causes a big issue.

I have also tested it with the TinyMCE egg an all the Kupu Javascript turned off and the issue still persists, so I'm not so sure it is a Kupu issue, it seems a more broad issue deeper in plone.

comment:3 Changed 2 years ago by limi

  • Component changed from Unknown to Visual Editor

comment:4 Changed 2 years ago by arrowman

  • Owner set to arrowman
  • Status changed from new to assigned
  • Component changed from Visual Editor to Infrastructure
  • Keywords kupu removed

The same problem indeed also occurs with TinyMCE. Not because the issue is deeper in Plone, but because Plone's TinyMCE integration has choosen the same policy as Kupu: store relative links in HTML text.

I've recently solved the same problem in one of my own content types (HTML text with relative links was put in another context with a Deliverance href rule). I solved it in the way Duncan suggested: relative links are converted in the browser view to root-relative links that are correct anywhere in the site.

I'll see how I can fix it a similar way in the static html portlet.

Setting component to Infrastructure, since the editor is not to blame and the portlet implementation should deal with the relative link issue when it puts content in a different context.

comment:5 Changed 2 years ago by arrowman

  • Summary changed from errors on internal links in portlet_static with kupu to Internal links in static text portlet become incorrect in display context

comment:6 Changed 18 months ago by pbauer

A workaround may be to force Kupu and TinyMCE to create links using resolveuid in static portlets? Since #9194 is resolved there is no more penalty concerning search engines.

comment:7 Changed 9 months ago by WouterVH

This issue might be related: #11355

comment:8 Changed 5 weeks ago by tkimnguyen

You may want to have a look at this product, by David Hietpas, which examines the creation context of the portlet and regenerates the URLs correctly

 https://svn.it.uwosh.edu/svn/plone/Projects/uwosh.static.fix/

Note: See TracTickets for help on using tickets.