Skip Menu |

This queue is for tickets about the OAuth-Lite CPAN distribution.

Report information
The Basics
Id: 40112
Status: open
Priority: 0/
Queue: OAuth-Lite

People
Owner: Nobody in particular
Requestors: evaldas [...] imbrasas.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: lyo.kato [...] gmail.com
Subject: Bug report: OAuth::Lite::Util::normalize_params doesn't support value arrays
Date: Thu, 16 Oct 2008 15:26:33 -0700
To: bug-OAuth-Lite [...] rt.cpan.org
From: "Evaldas Imbrasas" <evaldas [...] imbrasas.com>
Lyo, This is a bug report for OAuth::Lite. From what I'm seeing looking at the code, it seems that OAuth::Lite::Util::normalize_params() method doesn't support parameter arrayrefs as values when stringifying the params hashref. Parameter values are arrayrefs when checkbox, multiple select, or simply multiple values for each parameter are submitted via APIs. Here's a fix + working example/test. I'd appreciate if you could add this fix soon, because I didn't find an easy way to override this functionality the way you've designed this package. Thanks, Evaldas. ----- #!/usr/bin/perl use URI::Escape; sub encode_param { my $param = shift; URI::Escape::uri_escape_utf8($param, '^\w.~-'); } sub normalize_params { my $params = shift; my @params = map { my $key = $_; my $value = $params->{$key}; if (ref($value) && (ref($value) eq 'ARRAY')) { my @these_values = (); for my $this_value (@$value) { push(@these_values, sprintf('%s=%s', encode_param($key), encode_param($this_value))); } join('&', @these_values) } else { sprintf('%s=%s', encode_param($_), encode_param($params->{$_})) } } grep { ($_ ne 'realm') && ($_ ne 'oauth_signature') } keys %$params; return join('&', sort { $a cmp $b } @params); } print normalize_params({ a => 'a1', b => 'a2', c => 'a1' }) . "\n\n"; print normalize_params({ a => [ 'a1', 'a2', 'a3' ], b => 'a2' }) . "\n\n"; ---- -- ----------------------------------------------------- Evaldas Imbrasas http://www.imbrasas.com
Fixed at 1.14?