[ofbiz-framework] branch trunk updated: Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro (OFBIZ-11317)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro (OFBIZ-11317)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 969f48b  Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro (OFBIZ-11317)
969f48b is described below

commit 969f48b7c9f692b8a6f1c54e2b4ce6ae1392961b
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat Feb 15 13:24:09 2020 +0100

    Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro
    (OFBIZ-11317)
   
    In some place, like at least themes/tomahawk/template/AppBarClose.ftl the CSRF
    token is not generated. Because in those places OfbizUrlTransform is used.
   
    An immediate solution is to add the CSRF token generation in OfbizUrlTransform
    class.
   
    A definitive solution is to complete OFBIZ-11229
    "Merge UrlRegexpTransform and OfbizUrlTransform classes"
---
 .../src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
index 554a373..495b4cb 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizUrlTransform.java
@@ -98,6 +98,7 @@ public class OfbizUrlTransform implements TemplateTransformModel {
         final boolean secure = checkBooleanArg(args, "secure", false);
         final boolean encode = checkBooleanArg(args, "encode", true);
         final String webSiteId = convertToString(args.get("webSiteId"));
+        final String controlPath = convertToString(args.get("controlPath"));
 
         return new Writer(out) {
 
@@ -144,7 +145,8 @@ public class OfbizUrlTransform implements TemplateTransformModel {
                         HttpServletResponse response = FreeMarkerWorker.unwrap(env.getVariable("response"));
                         String requestUrl = buf.toString();
                         RequestHandler rh = RequestHandler.from(request);
-                        out.write(rh.makeLink(request, response, requestUrl, fullPath, secure, encode));
+                        String link = (rh.makeLink(request, response, requestUrl, fullPath, secure, encode, controlPath));
+                        out.write(link);
                     } else {
                         out.write(buf.toString());
                     }