Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-7538

Request attributes not correctly reset after using data-sly-resource or data-sly-include with requestAttributes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • Scripting HTL Engine 1.0.20
    • None
    • Scripting
    • None

    Description

      The option requestAttributes introduced with SLING-5812 does not correctly reset the request attributes after the request dispatcher returned. The reason for that is that https://github.com/apache/sling-org-apache-sling-scripting-sightly/blob/3b50f91c4f600081f0585e50dfb775c4b2856b89/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java#L115 does only reset those reset attributes which have been previously attached to the request. In fact also all attributes which have been added initially through the requestAttributes option need to be removed as well. If you add a new request attribute to the request this new request attribute will not be removed and would still be leveraged in a subsequent call to `data-sly-resource` based on the same request (even if that one doesn't even set an option requestAttributes).
      The same applies to https://github.com/apache/sling-org-apache-sling-scripting-sightly/blob/3b50f91c4f600081f0585e50dfb775c4b2856b89/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java#L73.

      Attachments

        Issue Links

          Activity

            People

              radu Radu Cotescu
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: