[MULTISITE-33] All the href link is incorrect on mobile if change server>admin=false Created: 21/Nov/14  Updated: 16/Feb/15  Resolved: 16/Feb/15

Status: Closed
Project: Magnolia Multisite Module
Component/s: None
Affects Version/s: 1.1.2
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Nguyen Ky Thanh Assignee: Unassigned
Resolution: Workaround exists Votes: 0
Labels: framework
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all mobile devices and simulator.


Attachments: PNG File error.PNG     PNG File magnolia_bug.PNG     PNG File magnolia_bug_2.PNG     PNG File magnolia_desktop_ok.PNG     PNG File no_domain_node.png    
Issue Links:
supersession
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:

 Description   

When change configuration server>admin=false.
All the link is display incorrect in mobile devices.
Ex:
On desktop: <a href="/magnoliaAuthor/Home.html">Home</a>
But on mobile: <a href="http://localhost:8001/magnoliaAuthor/Home.html">Home</a>

=> It automatically add the ip (or localhost) to the link as prefix.



 Comments   
Comment by Jan Haderka [ 21/Nov/14 ]

Is that happening only on the cell phone or in preview as-if-on-cell-phone done on the desktop?

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

When change server>admin=false => it happens on both.
When change server>admin=true => It only happens on preview as-if-on-cell-phone.

Thank you.

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

I use the function: templatingFunctions.link()
to render the link.
I tried to debug but the business is so complicated.

Comment by Jan Haderka [ 21/Nov/14 ]

can you try to open Configuration app and change /server/rendering/linkManagement@makeBrowserLinksRelative to true and see what happens?

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

Hi Jan, it still happens. Nothing changes.

Comment by Jan Haderka [ 21/Nov/14 ]

What you ultimately end up using is info.magnolia.link.LinkUtil.createLink(Node) which in turn will call LinkTransformerManager.getInstance().getBrowserLink(node.getPath()).transform(createLinkInstance(node));

The reason why you see it in preview is (iirc) because preview is done in iframe and thus needs to create full url. Why you see it also on the phone is weird and should not be the case. I can imagine that by switching admin mode to false, the version of the page generated for preview ends up in the cache and is then served to phone as well, but maybe I'm wrong here and there is some other issue at play.

Best would be to put a breakpoint in LinkTransformerManager.getBrowserLink(String) and see what it resolves when. There are different types of link producers that this method can return and it seem to be resolving wrong one. If you find that method to be a source of issue, you can customise link transformer manager and use that until the bug itself can be fixed. To set customised LTM to use, just set it in config:/server/rendering/linkManagement/class.
If yo udo fix the issue, it would be also nice if you can contribute the fix back. Thx.

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

Thank you Jan, I will try to resolve it.

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

One more thing, I am using the enterprise version.
linkManagement: info.magnolia.multisite.MultiSiteLinkTransformerManager

Comment by Jan Haderka [ 21/Nov/14 ]

which messes up things even more OK, so what you probably want to look at is CompoundLinkTransformer class from the multisite module. And if that confirms the suspicion, you might want to move this issue to multisite (or I can if you don't have that permission on jira).

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

Yes, please help to move it to multisite jira.

Here is my debug tracking:
CompoundLinkTransformer#isTargetExternal() : always return true;
=>
CompoundLinkTransformer#transform

  • targetContentSite = siteManager.getAssignedSite(link.getNode().getJCRNode()) : may return something wrong.
    =>
    MultiSiteManager#getAssignedSite(javax.jcr.Node) : root cause.
    =>
    ... I can not guess more.

Thank you Jan.

Comment by Nguyen Ky Thanh [ 21/Nov/14 ]

I've already post the bug to multisite module.

Comment by Jan Haderka [ 21/Nov/14 ]

I moved it. If there's other issue, pls link them together.

Comment by Nguyen Ky Thanh [ 28/Nov/14 ]

Hi @Jan,
May I know the status of this issue? Is it in processing?
It happens with image "src" also (except images using stk imaging).

Thank you.

Comment by Nguyen Ky Thanh [ 03/Feb/15 ]

Dear @Jan, Magnolia Team

I posted this issue long time ago, but until today I still cannot know the status of issue or any feedback from magnolia team.
Could you please give any information related to this problem?

Thank you so much
John

Comment by Philip Mundt [ 05/Feb/15 ]

Hi Nguyen.

This look to be related to MULTISITE-28 (which fixed basically what you are describing). You reported MULTISITE-32 to be affected in version 1.1.1.
Did you try it with version 1.1.2? I was not able to reproduce the described behavior with that version...

See also:
http://demopublic.magnolia-cms.com/demo-project/about.html?mgnlChannel=smartphone
http://demopublic.magnolia-cms.com/demo-features.html?mgnlChannel=smartphone

Kind regards
Philip

Comment by Philip Mundt [ 05/Feb/15 ]

I closed MULTISITE-32 as duplicate.

Comment by Nguyen Ky Thanh [ 05/Feb/15 ]

Dear @Philip Mundt,

Thank you for your response, I also have found the rood cause of this issue.
If there is no domains node configuration in site definition, the issue will occur.
I dont know that is a problem or not.
Please see at the attach image for this note.

Thank again.

Comment by Philip Mundt [ 05/Feb/15 ]

Hey Nguyen.

Yes, that is a known limitation (see SUPPORT-3834, related to MULTISITE-28)!
The domain comparison is used as one of the checks to see whether the link is external or not...

Does that "fix" your problem?

Regards
Philip

Comment by Nguyen Ky Thanh [ 07/Feb/15 ]

Thanks Philip,
I think that fixed my problem !

Comment by Philip Mundt [ 16/Feb/15 ]

Closing this issue because a workaround exists:

Providing a domain-mapping in the site configuration solves the problem.

A link (of the current site) is handled as an internal link when:

  1. site name matches the target site name
  2. site is the default site
  3. a domain mapping matches a domain mapping of target site
Generated at Mon Feb 12 06:05:46 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.