Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative links are interpreted relative to Site Root, not the content object #7

Closed
reinhardt opened this Issue Nov 19, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@reinhardt
Copy link

reinhardt commented Nov 19, 2013

If my site has the id Plone and contains the page /Plone/en/materials/materials, who's text field contains the link

<a href="../partners">...</a>

then the rendered page links to localhost:8080/partners. What I would expect (and what Archtypes does) is the link to point to localhost:8080/Plone/en/partners.

The reason is that RichTextValue.output() uses the site as the context for calling portal_transforms. What it should do is use the content object.

See https://github.com/plone/plone.app.textfield/blob/master/plone/app/textfield/value.py#L70

@thet

This comment has been minimized.

Copy link
Member

thet commented May 2, 2014

i run into the same issue, which partially destroyed links on my site 8/ (after editing/saving. and while migrating!)

my hackis fix for that is to avoid the transformation at all:
https://github.com/plone/plone.app.textfield/tree/thet-fix-issue7

the context seems not to be available at the your referenced line of code.

@davisagli

This comment has been minimized.

Copy link
Member

davisagli commented May 6, 2014

Use RichTextValue.output_relative_to() and pass in the context.

thet added a commit that referenced this issue Jul 16, 2015

Fix issue, where the RichTextValue.output was transforming relative t…
…o an ISite object. This broke relative links and for subsites also internal absolute links. Fixes: #7

thet added a commit to plone/plone.app.contenttypes that referenced this issue Dec 20, 2015

Change all text getters on plone.app.textfield.value.RichTextValue ob…
…jects to output_relative_to with the current context. This correctly transforms relative links. See: plone/plone.app.textfield#7

jensens added a commit to plone/buildout.coredev that referenced this issue Dec 22, 2015

[fc] Repository: plone.app.contenttypes
Branch: refs/heads/master
Date: 2015-12-21T00:54:17+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: plone/plone.app.contenttypes@0f5c603

Change all text getters on plone.app.textfield.value.RichTextValue objects to output_relative_to with the current context. This correctly transforms relative links. See: plone/plone.app.textfield#7

Files changed:
M CHANGES.rst
M plone/app/contenttypes/browser/folder.py
M plone/app/contenttypes/browser/templates/newsitem.pt
Repository: plone.app.contenttypes
Branch: refs/heads/master
Date: 2015-12-22T13:34:44+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.contenttypes@7ef1ded

Merge pull request #308 from plone/thet-output_relative_to

Change all text getters on plone.app.textfield.value.RichTextValue ob…

Files changed:
M CHANGES.rst
M plone/app/contenttypes/browser/folder.py
M plone/app/contenttypes/browser/templates/newsitem.pt
@thet

This comment has been minimized.

Copy link
Member

thet commented Feb 2, 2016

Yes, you have to call the output method of the RichTextValue and pass the current context to it - as the RichTextValue cannot access the context itself.
Like: <p tal:content="structure python:context.text.output_relative_to(view.context)"/> ( https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/templates/document.pt )

@thet thet closed this Feb 2, 2016

@reinhardt

This comment has been minimized.

Copy link
Author

reinhardt commented Feb 3, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.