URLDecode: Copying behaviour of old goodie
parent
924f60b413
commit
da73c6f545
|
@ -25,10 +25,18 @@ handle query_raw => sub {
|
|||
s/(^$trigger_words)|($trigger_words$)//i;
|
||||
s/(^\s+)|(\s+$)//;
|
||||
|
||||
my $decoded_url = decodeURIComponent($_);
|
||||
my $decoded = decodeURIComponent($_);
|
||||
|
||||
my $text = "URL Decoded: $decoded_url";
|
||||
my $html = '<div class="zci--urldecode"><span class="text--secondary">URL Decoded: </span><span class="text--primary url_decoded">'.html_enc($decoded_url).'</span></div>';
|
||||
if($decoded =~ /^\s+$/)
|
||||
{
|
||||
$decoded =~ s/\r/CReturn/;
|
||||
$decoded =~ s/\n/Newline/;
|
||||
$decoded =~ s/\t/Tab/;
|
||||
$decoded =~ s/\s/Space/;
|
||||
}
|
||||
|
||||
my $text = "URL Decoded: $decoded";
|
||||
my $html = '<div class="zci--urldecode"><span class="text--secondary">URL Decoded: </span><span class="text--primary url_decoded">'.html_enc($decoded).'</span></div>';
|
||||
|
||||
return $text, html => $html;
|
||||
};
|
||||
|
|
|
@ -57,6 +57,10 @@ ddg_goodie_test(
|
|||
"URL Decoded: https://duckduckgo.com/",
|
||||
html => qr#https://duckduckgo\.com/#
|
||||
),
|
||||
'%20' => test_zci(
|
||||
'URL Decoded: Space',
|
||||
html => qr#URL Decoded:.*Space#
|
||||
),
|
||||
'38% of 100 GBP' => undef,
|
||||
'url decode tool' => undef,
|
||||
'url decode online' => undef
|
||||
|
|
Loading…
Reference in New Issue