Tapestry
  1. Tapestry
  2. TAPESTRY-2054

page activation context with spaces are incorrectly decoded when using forms

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.8
    • Fix Version/s: 5.0.10
    • Component/s: None
    • Labels:
      None
    • Environment:
      os x; java 1.5; Firefox 2.0

      Description

      Page activation contexts are stored in form requests as hidden parameter values. However, when the value is retrieved on the server side, spaces aren't unescaped.
      Hence, context values such as "foo bar" will wind up being passed into onActivate as "foo%20bar".
      I will attach a sample project + test case which illustrates this issue.

      1. contexttest.tgz
        8 kB
        Robert Zeigler
      2. page_context_in_form_fix.patch
        1 kB
        Yoshikazu Kuramochi
      3. page_context_in_form_test.patch
        4 kB
        Yoshikazu Kuramochi

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Thanks, nice patch!

        Show
        Howard M. Lewis Ship added a comment - Thanks, nice patch!
        Hide
        Yoshikazu Kuramochi added a comment -

        This is caused by my incomplete fix of TAPESTRY-1988.

        When using form, page activation context needs only escaping percents and slashes in LinkFactoryImpl#addActivationContextToLink, not needs encoding.

        [page_context_in_form_fix.patch]

        • Add a argument 'forForm' to LinkFactoryImpl#addActivationContextToLink.
        • In the method, use TapestryInternalUtils#escapePercentAndSlash when forForm is true,
          otherwise use TapestryInternalUtils#encodeContext.

        [page_context_in_form_test.patch]

        • Test page: PageContextInForm.tml, PageContextInForm.java
        • Test method: IntegrationTests#page_context_in_form
        Show
        Yoshikazu Kuramochi added a comment - This is caused by my incomplete fix of TAPESTRY-1988 . When using form, page activation context needs only escaping percents and slashes in LinkFactoryImpl#addActivationContextToLink, not needs encoding. [page_context_in_form_fix.patch] Add a argument 'forForm' to LinkFactoryImpl#addActivationContextToLink. In the method, use TapestryInternalUtils#escapePercentAndSlash when forForm is true, otherwise use TapestryInternalUtils#encodeContext. [page_context_in_form_test.patch] Test page: PageContextInForm.tml, PageContextInForm.java Test method: IntegrationTests#page_context_in_form
        Hide
        Robert Zeigler added a comment -

        maven project with a single (integration) test case that exposes the error.

        Show
        Robert Zeigler added a comment - maven project with a single (integration) test case that exposes the error.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Robert Zeigler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development