[MAGNOLIA-335] Path for images and links not created correctly when not running as root context Created: 18/Apr/05  Updated: 15/Jun/05  Resolved: 15/Jun/05

Status: Closed
Project: Magnolia
Component/s: core, samples
Affects Version/s: 2.1 Final
Fix Version/s: 2.1 Final

Type: Bug Priority: Minor
Reporter: Christian Menzel Assignee: Boris Kraft
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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

 Description   

Magnolia 2.1 renders the path for images and links absolut, without
taking the context into account. When magnolia is not installed as root
context, the context path has to be used as prefix when images and links
are referenced in the JSPs.
I'm not sure whether this should be done in the getNodeData() method or
should be left to the JSP developer.

The current textImage.jsp is not working correctly when magnolia is not
the root context, I think the attached patch should be applied.

Index: /home/chris/workspace/magnolia-2.1/src/webapp/templates/jsp/samples/paragraphs/textImage.jsp
===================================================================
— /home/chris/workspace/magnolia-2.1/src/webapp/templates/jsp/samples/paragraphs/textImage.jsp (revision 514)
++
+ /home/chris/workspace/magnolia-2.1/src/webapp/templates/jsp/samples/paragraphs/textImage.jsp (working copy)
@@ -6,7 +6,7 @@
<c:set var="imageurl">
<cms:out nodeDataName="image" />
</c:set>

  • <img src="${imageurl}" class="${imagedata.imageFloat}"
    alt="${imagedata.imageAlt}" />
    + <img src="${pageContext.request.contextPath}${imageurl}"
    class="${imagedata.imageFloat}" alt="${imagedata.imageAlt}" />
    </cms:ifNotEmpty>

<cms:ifNotEmpty nodeDataName="title">


Generated at Mon Feb 12 03:16:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.