Skip to content

Commit

Permalink
Item11862: Item11814: Fix roundtrip of URL macros
Browse files Browse the repository at this point in the history
Broken by the intital fix to Item11814.  Revert the fix to Item11814 and
remove the url decode.

git-svn-id: http://svn.foswiki.org/trunk@14826 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed May 15, 2012
1 parent 17ceb37 commit c1c08d9
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,10 @@ sub _handleA {
( $this->{attrs}->{class}
&& $this->{attrs}->{class} =~ m/\bTMLlink\b/ );

# decode URL params in the href
$href =~ s/%([0-9A-F]{2})/chr(hex($1))/gei;
# SMELL: Item11814 - this corrupts URL's that must be encoded, ex. embedded Newline
# decode URL params in the href
#$href =~ s/%([0-9A-F]{2})/chr(hex($1))/gei;

if ( $this->{context} && $this->{context}->{rewriteURL} ) {
$href = $this->{context}->{rewriteURL}->( $href, $this->{context} );
}
Expand Down Expand Up @@ -1446,22 +1448,17 @@ sub _handleA {
return ( 0, $WC::CHECK1 . $nop . $text . $WC::CHECK2 );
}
if ( $text eq $href ) {
return ( 0,
$WC::CHECKw . '[' . $nop . '[' . $this->{attrs}{href} . ']]' );
return ( 0, $WC::CHECKw . '[' . $nop . '[' . $href . ']]' );
}

# we must quote square brackets in [[...][...]] notation
$text =~ s/[[]/[/g;
$text =~ s/[]]/]/g;
$this->{attrs}{href} =~ s/[[]/%5B/g;
$this->{attrs}{href} =~ s/[]]/%5D/g;
$text =~ s/[[]/[/g;
$text =~ s/[]]/]/g;
$href =~ s/[[]/%5B/g;
$href =~ s/[]]/%5D/g;

return ( 0,
$WC::CHECKw . '['
. $nop . '['
. $this->{attrs}{href} . ']['
. $text
. ']]' );
$WC::CHECKw . '[' . $nop . '[' . $href . '][' . $text . ']]' );
}
elsif ( $this->{attrs}->{name} ) {

Expand Down

0 comments on commit c1c08d9

Please sign in to comment.