[MAGNOLIA-6243] Inline rich text links don't work on public instances when using custom URL mappings Created: 04/Jun/15  Updated: 22/Nov/16  Resolved: 23/Sep/15

Status: Closed
Project: Magnolia
Component/s: fckeditor
Affects Version/s: 4.5.24
Fix Version/s: 4.5.26

Type: Bug Priority: Neutral
Reporter: Nils Breunese Assignee: Evzen Fochr
Resolution: Fixed Votes: 0
Labels: Support
Remaining Estimate: 0d
Time Spent: 1d 7h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLETK-131 uri-starts-with-sitename rule should ... Closed
relates to MAGNOLIA-6388 Uri2RepositoryMapping.getHandle() all... Closed
relates to MULTISITE-48 When I modify the site evaluation rul... Closed
causality
is causing MAGNOLIA-6600 Failed to resolve path under root con... Closed
relation
is related to MAGNOLIA-6882 Remove legacy code that allows to acc... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Kromeriz 11
Story Points: 5

 Description   

We have modified Magnolia's multisite request matcher rules to avoid pages being available on multiple URI's, and to avoid all sites being available on all domains through their prefix. We did this by moving config:/modules/extended-templating-kit/config/rules/uri-starts-with-sitename below its handle-not-empty sibling.

Afterwards we found that all of our inline rich text links were broken, because the link URI's are generated (by RepositoryBrowserPage#resolveAbsoluteURI()) and stored in the rich text HTML when the link is created, while assuming the default mappings apply on public instances, which is not necessarily the case.

An example from our setup:

  1. Add a TextImage component to a page.
  2. Type some text into the rich text editor, select a word to link and click the Insert/Edit Link button.
  3. Click the Browse Server button and select a page from the website tree, e.g. /site/path/to/page
  4. The code in RepositoryBrowserPage generates /site/path/to/page.html as the absolute URI, which gets stored in the text property of the TextImage component.
  5. Activate the page and request the page on a public instance.
  6. The inline link points to /site/path/to/page.html (as expected, because that's what was stored in the rich text HTML), but this is not a valid URI on our public instance. In this case it should be /path/to/page.html, as /site is the handlePrefix of this site.

An idea might be to have this work like the internal teaser, storing a target UUID and generating the link at render time instead of creation time.

Also, we noticed that magnolia-module-fckeditor no longer exists in Magnolia 5, but this mechanism might have been carried over to the new rich text editor? Or is Magnolia 5 handling this differently?



 Comments   
Comment by Jan Haderka [ 21/Sep/15 ]

old fckEditor have been replaced by ckEditor. Mechanism is exactly same.

The problem you are facing with ckEditor is caused by removal of part of the code that is locating path for the content and trying to determine whether it has shortened url or not.

Comment by Milan Divilek [ 22/Sep/15 ]

Reopen: patch is not correct, handle is not added into link when saving dialog second time.

1. Add new URI2RepositoryMapping

  • URIPrefix - /test
  • handlePrefix - /demo-project/about/subsection-articles/article
  • repository - website

2. Go to some page where is "Text and Image" component available. For example to http://localhost:8080/magnoliaAuthor/demo-project/about/history.html
3. Open "Text and Image" component select "Insert/Edit link" and select demo-project/about/subsection-articles/article page
3. Save dialog and check link. It's correctly resolved as http://localhost:8080/magnoliaAuthor/test
Check property in jcr link is stored as

${link:{uuid:{d1b4b57d-3b5d-41ae-85f2-8ed2e4c186ea},repository:{website},handle:{/demo-project/about/subsection-articles/article},nodeData:{},extension:{html}}}

4. Open dialog and save it again
5. Link is incorrectly resolved as http://localhost:8080/magnoliaAuthor , this is because link is stored as

${link:{uuid:{},repository:{website},handle:{/},nodeData:{},extension:{html}}
Generated at Mon Feb 12 04:12:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.