Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -N -r1.140.2.75 -r1.140.2.76 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 24 Apr 2017 15:53:45 -0000 1.140.2.75 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 24 Apr 2017 18:39:29 -0000 1.140.2.76 @@ -550,7 +550,7 @@ -entire_form:boolean -no_empty:boolean {-base} - -base_encode:boolean + -no_base_encode:boolean {-anchor} {-exclude {}} {-override {}} @@ -695,8 +695,8 @@ along with a question mark (?), if the query is non-empty. so the returned string can be used directly in a link. This is only relevant to URL export. - @option base_encode Decides whether argument passed as base option will be - encoded by ad_urlencode_url proc + @option no_base_encode Decides whether argument passed as base option will be + encoded by ad_urlencode_url proc @author Lars Pind (lars@pinds.com) @creation-date December 7, 2000 @@ -932,17 +932,24 @@ if { $quotehtml_p } { set export_string [ns_quotehtml $export_string] } - + # Prepend with the base URL if { [info exists base] && $base ne "" } { - # if required, encode url part as well - if {$base_encode_p} { - set base [ad_urlencode_url $base] + if { [string first ? $base] > -1 } { + # The base already has query vars; assume that the + # path up to this point is already correctly encoded. + set export_string $base[expr {$export_string ne "" ? "&$export_string" : ""}] + } else { + # The base has no query vars: encode url part if not + # explicitly said otherwise. Include also as exception + # trivial case of the base being the dummy url '#'. + if {!$no_base_encode_p && $base ne "#"} { + set base [ad_urlencode_url $base] + } + set export_string $base[expr {$export_string ne "" ? "?$export_string" : ""}] } - - set export_string $base[expr {[string first ? $base] > -1 ? "&" : "?"}]$export_string } - + # Append anchor if { [info exists anchor] && $anchor ne "" } { append export_string "\#$anchor"