Index: openacs-4/packages/acs-tcl/tcl/defs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/defs-procs.tcl,v diff -u -r1.81.2.9 -r1.81.2.10 --- openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 19 Feb 2021 10:18:21 -0000 1.81.2.9 +++ openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 6 Aug 2021 04:40:27 -0000 1.81.2.10 @@ -532,20 +532,22 @@ ad_proc -public ad_return_url { -urlencode:boolean + {-path_encode:boolean true} -qualified:boolean {-default_url .} {extra_args ""} } { Build a return url suitable for passing to a page you expect to return back - to the current page. + to the current page. Per default, the result is URL-encoded + (like the result of "export_vars" or ":pretty_link").

Example for direct inclusion in a link:

-    ad_returnredirect "foo?return_url=[ad_return_url -url_encode]"
+    ad_returnredirect "foo?return_url=[ad_return_url]"
     
Example setting a variable to be used by export_vars: @@ -563,13 +565,17 @@ @author Don Baccus (dhogaza@pacifier.com) - @param urlencode If true URL-encode the result + @param path_encode If false do no URL-encode the result @param default_url When there is no connection, fall back to this URL @param qualified If provided the return URL will be fully qualified including http or https. @param extra_args A list of {name value} lists to append to the query string } { + if { $urlencode_p } { + ns_log warning "deprecated flag -urlencode; result us encoded per default" + } + if {[ns_conn isconnected]} { set query_list [export_entire_form_as_url_vars] set base_url [ns_conn url] @@ -578,24 +584,29 @@ set base_url $default_url } + if { $path_encode_p } { + set base_url [ns_urlencode $base_url] + } + if { [llength $query_list] == 0 } { set url $base_url } else { set url "${base_url}?[join $query_list &]" } if {[llength $extra_args] > 0} { - set url [export_vars -base $url $extra_args] + # + # Deactivate base encode, since the input URL is already + # encoded as requested. + # + set url [export_vars -base $url -no_base_encode $extra_args] } if { $qualified_p } { # Make the return_url fully qualified set url [security::get_qualified_url $url] } - if { $urlencode_p } { - set url [ns_urlencode $url] - } return $url }