<?xml version="1.0" encoding="UTF-8"?>
<issue>
  <id>1826</id>
  <project name="Redmine" id="1"/>
  <tracker name="Defect" id="1"/>
  <status name="Closed" id="5"/>
  <priority name="Normal" id="4"/>
  <author name="Robert Chady" id="1752"/>
  <fixed_version name="0.8" id="2"/>
  <subject>back_url entry becomes urlencoded</subject>
  <description>I just updated my test install to the latest SVN version and noticed that back_url containd %2fredmine%2f instead of /redmine/.  I had also done some apache configuration changes so I'm not sure if this was due to the Redmine update or my changes.  Anyhow, I did verify that if back_url gets urlencoded, the call to redirect_to is going to result in getting directed to an invalid URL.

I'm not sure of the 'right' way to handle this -- I believe you need to either make sure it does not become urlencoded in the first place, or at least make sure the redirect_to call urldecodes it first.  

On my test install I did a quick hack to add in a CGI::unescape() call inside the redirect_to call and it does work, but I'm not sure if that is the "best" way or not.  I'll leave that decision to the people in charge. :)


</description>
  <start_date>2008-08-28</start_date>
  <due_date></due_date>
  <done_ratio>0</done_ratio>
  <estimated_hours></estimated_hours>
  <custom_fields>
    <custom_field name="Affected version" id="1">devel</custom_field>
    <custom_field name="Resolution" id="2">Fixed</custom_field>
  </custom_fields>
  <created_on>Thu Aug 28 03:05:36 +0200 2008</created_on>
  <updated_on>Sat Oct 18 12:38:43 +0200 2008</updated_on>
  <journals>
    <journal id="4877">
      <user name="Jean-Philippe Lang" id="1"/>
      <notes>I could not reproduce this problem. What's your Rails version and browser?
Anyway, I've added a call to @CGI.unescape@ in @ApplicationController#redirect_back_or_default@ that should solve this problem (r1893).</notes>
      <details>
        <detail old="1" name="status_id" property="attr" new="3"/>
        <detail old="" name="fixed_version_id" property="attr" new="2"/>
        <detail old="" name="2" property="cf" new="Fixed"/>
      </details>
    </journal>
    <journal id="4915">
      <user name="Robert Chady" id="1752"/>
      <notes>I'm using Rails 2.1.0 and Firefox 3.0.1.  This behavior did not show up until I had reconfigured apache to use a &lt;Location&gt; block for redmine rewriting it to a redmine_cluster w/mongrel_cluster.  Everything worked as expected, other than the back_url suddenly getting urlencoded like I mentioned.

Having run this with my changes, which are basically the same that you did, for a couple weeks now, everything looks good now.

Thanks!
</notes>
      <details>
      </details>
    </journal>
    <journal id="5205">
      <user name="Jean-Philippe Lang" id="1"/>
      <notes>Thanks for the feedback.</notes>
      <details>
        <detail old="3" name="status_id" property="attr" new="5"/>
      </details>
    </journal>
  </journals>
</issue>
