[MGNLREST-363] richTextLinkReferenceResolver doesn't resolve localised link for all languages Created: 27/Apr/22  Updated: 21/Mar/23  Resolved: 21/Mar/23

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 2.2.12
Fix Version/s: 2.2.17

Type: Bug Priority: Neutral
Reporter: Jonathan Ayala Assignee: Dai Ha
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: File testEndpoint_v1.yaml     File website.travel.test.yaml    
Issue Links:
Cloners
is cloned by MGNLREST-655 CLONE - richTextLinkReferenceResolver... Closed
causality
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLREST-649 Implement Sub-task Completed Dai Ha  
MGNLREST-650 Review Sub-task Completed Jaroslav Simak  
MGNLREST-651 piQA Sub-task Completed Milan Divilek  
MGNLREST-653 QA Sub-task Completed Canh Nguyen  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:
Epic Link: Support
Sprint: DevX 33
Story Points: 5
Team: DeveloperX
Work Started:

 Description   

When passing parameter lang=all in a request to a endpoint with a richTextLinkReferenceResolver, links are not resolved according to their language.

Steps to reproduce

  1. Make use of the attached endpoint testEndpoint_v1.yaml
  2. Create a basic page with a text and image component filled with a link to a page both in English and German website.travel.test.yaml
  3. Send a request to http://localhost:8080/magnoliaAuthor/.rest/delivery/testEndpoint/v1?lang=all

Expected results

Links in rich text fields are resolved for each locale

Actual results

Links in rich text fields are not resolved for each locale:

"text": "<p>this is a test <a href=\"/magnoliaAuthor/visit-finland.html\">link</a></p>\n",
"text_de": "<p>this is a test <a href=\"/magnoliaAuthor/visit-finland.html\">link</a> GERMAN</p>\n",

However, sending a request with lang=de: http://localhost:8080/magnoliaAuthor/.rest/delivery/testEndpoint/v1?lang=de

"text": "<p>this is a test <a href=\"/magnoliaAuthor/de/visit-finland.html\">link</a> GERMAN</p>\n",

returns a correctly resolved link with the locale in the URL.



 Comments   
Comment by Marek Strucka [ 02/Sep/22 ]

The issue has been successfully reproduced by creating a light module and debugged. The problem lies in wrongly resolving the richtext and the transformer getting a wrong locale information, namely:
RichTextLinkResolver.resolve() is called and from there, LinkUtil.convertLinksFromUUIDPattern(richText, transformer) is called, where the transformer.transform(link) method cannot get the correct locale information (it only returns “en”).
We would need to get the code to generate a different link when the locale is other than “en”.

Generated at Mon Feb 12 06:59:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.