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 53aee0f commit 3daf071
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
Expand Up @@ -1410,8 +1410,10 @@ sub _handleA {
( $this->{attrs}->{class} ( $this->{attrs}->{class}
&& $this->{attrs}->{class} =~ m/\bTMLlink\b/ ); && $this->{attrs}->{class} =~ m/\bTMLlink\b/ );


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

if ( $this->{context} && $this->{context}->{rewriteURL} ) { if ( $this->{context} && $this->{context}->{rewriteURL} ) {
$href = $this->{context}->{rewriteURL}->( $href, $this->{context} ); $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 ); return ( 0, $WC::CHECK1 . $nop . $text . $WC::CHECK2 );
} }
if ( $text eq $href ) { if ( $text eq $href ) {
return ( 0, return ( 0, $WC::CHECKw . '[' . $nop . '[' . $href . ']]' );
$WC::CHECKw . '[' . $nop . '[' . $this->{attrs}{href} . ']]' );
} }


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


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


Expand Down

0 comments on commit 3daf071

Please sign in to comment.